Concatenate, Ignoring Blanks and VLOOKUP

squeezin

New Member
Joined
Oct 4, 2011
Messages
2
Ok, I'm trying to do the following :

I have a row of data in one sheet with a unique code in Column A.

In sheet 2 I also have the same unique code in Column A, in columns B-G I have some names of people but some of these could be blank

I basically want to lookup the unique codes in Column A and then for a match concatenate B-G in a single cell (Column B) on sheet 1.

Also, rather than the data put into the cell being delimited by a comma, I need to have each name on a seperate line within the cell.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
=INDEX(Sheet2!B:B,MATCH(A1,Sheet2!A:A),)&CHAR(10)&INDEX(Sheet2!C:C,MATCH(A1,Sheet2!A:A),)&CHAR(10)&INDEX(Sheet2!D:D,MATCH(A1,Sheet2!A:A),)&CHAR(10)&INDEX(Sheet2!E:E,MATCH(A1,Sheet2!A:A),)&CHAR(10)&INDEX(Sheet2!F:F,MATCH(A1,Sheet2!A:A),)&CHAR(10)&INDEX(Sheet2!G:G,MATCH(A1,Sheet2!A:A),)
 
Upvote 0
Thanks Sal, will give that a go, does it ignore blanks cells?

I had a go myself and came up with this :

Code:
=(VLOOKUP($A23,Sheet1!B:N,8,0))&CHAR(10)&(VLOOKUP($A23,Sheet1!B:N,9,0))&CHAR(10)&(VLOOKUP($A23,Sheet1!B:N,10,0))&CHAR(10)&(VLOOKUP($A23,Sheet1!B:N,11,0))&CHAR(10)&(VLOOKUP($A23,Sheet1!B:N,12,0)&CHAR(10)&(VLOOKUP($A23,Sheet1!B:N,13,0)))

But it doesn't ignore blanks cells, can't figure out how to do that.
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top