How to return column heading if there is a value in the row

sousouris

New Member
Joined
Feb 23, 2010
Messages
1
Hi,

I have a table. In the column A is a list of all classes available, in row 1 across the top of the table is a list of people. There is an 'x' in the appropriate cell to indicate which classes each person is taking.

Sample table:
A
B
C
D
E
1
All attendees
Person 1
Person 2
Person 3
2
Class 1
[BLANK]
x
x
3
Class 2
[BLANK]
x
x
x
4
Class 3
[BLANK]
x
x

<TBODY>
</TBODY>

Desired output:
I would like to put a formula in column B that lists all of the people per class.

I suspect I have to use a combintation of CONCATENATE and INDEX MATCH, but I'm less familiar with using INDEX MATCH.
A
B
C
D
E
1
All attendees
Person 1
Person 2
Person 3
2
Class 1
Person 1, Person 3
x
x
3
Class 2
Person 1, Person 2
x
x
4
Class 3
Person 2, Person 3
x
x

<TBODY>
</TBODY>

Can anyone help?


Thanks!

Sousouris
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Here is a non-VBA/UDF solution. In cell B2 and copied down use this formula:
=SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(IF(C2="x",C$1&"|","")&IF(D2="x",D$1&"|","")&IF(E2="x",E$1&"|","")," ","_"),"|"," "))," ",", "),"_"," ")


Add more &IF(E2="x".... statements as needed, just update the column letter for each one you add. If you'd rather have a VBA/UDF solution, let me know
 
Upvote 0

Forum statistics

Threads
1,216,219
Messages
6,129,575
Members
449,519
Latest member
Rory Calhoun

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