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:-

Required resultHeader 1Header 2Header 3Header 4Header 5
Header 1, Header 3, Header 4YNYYN
Header 2, Header 4, Header 5NYNYY

<tbody>
</tbody>

Thanks in advance
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,216,102
Messages
6,128,852
Members
449,471
Latest member
lachbee

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