Return cell headers from values in cell of multiple column

Miratshah

Board Regular
Joined
Nov 29, 2016
Messages
57
Hi,

I have few columns in which either there is Yes or no as values. I need a formula to return all column headers where there is yes separated by comma. I have more than 50000 records and have to do this on every other day. Is there a way to achieve this through a formula? Here is an example:-

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Required result[/TD]
[TD]Header 1[/TD]
[TD]Header 2[/TD]
[TD]Header 3[/TD]
[TD]Header 4[/TD]
[TD]Header 5[/TD]
[/TR]
[TR]
[TD]Header 1, Header 3, Header 4[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]Header 2, Header 4, Header 5[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
</tbody>[/TABLE]

Thanks in advance
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Re: Return cell headerS from values in cell of multiple column

1] Assume your data put in A1:F3 with header

2] In B2, copied across to F2 and all copied down :

=IF(ISNUMBER(FIND(B$1,$A2)),"Y","N")

Regards
Bosco
 
Upvote 0
Re: Return cell headerS from values in cell of multiple column

Hi Bosco_yip,

I guess i did not do a good job in explaining the problem.

I need final result in column A. Final result should be header values of those column cells, where there is Y. Therefore cell A2 as per table in 1st post is the required answer. I.e Header 1, Header 3, Header 4 because "Y" appears in those respective column.

Column "Required result" is I need to achieve through your help.
 
Upvote 0
Re: Return cell headerS from values in cell of multiple column

Then,

In A2, copied down :

=SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(IF(B2="Y",B$1,"")&"@"&IF(C2="Y",C$1,"")&"@"&IF(D2="Y",D$1,"")&"@"&IF(E2="Y",E$1,"")&"@"&IF(F2="Y",F$1,"")," ","#"),"@"," "))," ",", "),"#"," ")

Regards
Bosco
 
Upvote 0
Re: Return cell headerS from values in cell of multiple column

You are an angle sent from heaven. it works just like how I want it. Thank you bosco_yip.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

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