How to search a table/colum with 2 hits

Occasional Contributor



i have a table with Products and machines. If there is an "X" the machine could be use for this product.

I want to search for the Product and give out the possible machine Name. Possible machine is Marked with an "x"

For Example:Input.PNG

Output should be like shown in the Picture.


Output.PNGHow can i do this?

What Formula do i Need?


Thank you in advance

3 Replies

@DKoh , with model like this


you may use in B3

=IFERROR(INDEX($1:$1,AGGREGATE(15,6,1/($B2:$AA2="x")*(COLUMN($B$2:$AA$2)-COLUMN($A$5)+1), (COLUMN()-COLUMN($A$5)))),"")

, drag it to the right till empty cells appear and when to the down

@Sergei Baklan 

Please explain the formula

That would be great




Sorry, I missed that your question.


INDEX returns the value of the cell which is in entire (third parameter missed or zero) row (first parameter) on position defined with second parameter.


We find that position using AGGREGATE. It return Nth (fourth parameter) smallest (first parameter 15) from the array (third parameter) ignoring all errors (second parameter 6).  As an array we take column numbers of your data range multiplying them on 1/ logical check if the cell has the value "x". Since TRUE is equal to 1 and FALSE to 0, we have an array with ignoring errors or 1s. For the first current column  4th parameters return 1 (thus you find first smallest column number for the cell with "x"), for the next cell it'll be second smallest, etc.


Finally we wrap entire formula with IFERROR to return empty string if Nth smallest is not found.


You may stay on the cell with formula and check calculations by steps with Formula-Evaluate formula on ribbon.


Previous time I overcomplicated the formula a bit, it could be like

=IFERROR(INDEX($1:$1,AGGREGATE(15,6,1/($C2:$AB2="x")*COLUMN($C$2:$AB$2), (COLUMN()-COLUMN($B$5)))),"")
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
50 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
32 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
15 Replies
Dev channel update to 80.0.355.1 is live
josh_bodner in Discussions on
67 Replies