Index, Match, Smalls, etc. equation to return nth occurrence of a value in a row and then display column header data

sirloin16oz

New Member
Joined
Mar 5, 2019
Messages
3
Hi folks,

Need your help. I'm trying to find an equation to insert into cells E2:G5 that will look for the number of occurrences of the number “1” in a row, and then output the column header. I’ve been googling, and it seems this would require an equation using a combination of index, match, and smalls – and after two days of looking into this, I can’t figure it out.

Would really appreciate your input and help on what equation I could use.

Thank you!!!

Vince


[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Red[/TD]
[TD]Green[/TD]
[TD]Blue[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Bob[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]Red[/TD]
[TD]Green[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Mike[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]Green[/TD]
[TD]Blue[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Joe[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]Red[/TD]
[TD]Green[/TD]
[TD]Blue[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi & welcome to MrExcel
In E2 copied down & across
=IFERROR(INDEX($B$1:$D$1,AGGREGATE(15,6,COLUMN($B2:$D2)-COLUMN($B2)+1/($B2:$D2=1),COLUMNS($A:A))),"")
 
Last edited:
Upvote 0
Cross posted https://www.excelforum.com/excel-fo...ow-and-display-column-header.html#post5077395

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
You're welcome & thanks for the feedback.

And no, MrExcel is not related to any other site.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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