Finding and returning one of multiple potential values from a range

Richard Hill

New Member
Joined
Jun 4, 2009
Messages
4
Hi Everyone

Unfortunately I cannot download XL2BB (work IT security), so I have had to use the below screenshot.

I am working on a large formula and have got stuck on one component. For ease, I have broken out this component and simplified it as follows:

I have 5 values: MYTPP; MAPTM; EGPSD; ESALR; OMSLV.
I know that in each row of data, one of those values will appear somewhere in columns B:F. The exact column will vary from row to row.
I would like a formula in column G that will look for these 5 values in columns B:F and return whichever it finds.

In the example below, I have manually typed the expected result.

I have tried several array based formulas but cannot get one to work. I could use some convoluted nested ISNA/IF statement, but am looking for something shorter and simpler, because this spreadsheet will be handed over to others to use and maintain with less experience than me.

Many thanks in advance.

1590009709334.png
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Maybe:

Book1
ABCDEFG
11st Dicharge Port2nd Dicharge Port3rd Dicharge Port4th Dicharge Port5th Dicharge PortHUB PORT
2LKCMBMYTPPNLROTIEDUBMYTPP
3LKCMBMYTPPNLROTMYTPP
4MYTPPGBFXSMYTPP
5KRULSCNNPOMAPTMSLFNAMAPTM
6CNFOOHKHKGEGPSDNLROTSEGOTEGPSD
7CNFOOHKHKGSGSINESALRRULEDESALR
Sheet39
Cell Formulas
RangeFormula
G2:G7G2=LOOKUP(2,1/COUNTIF(B2:F2,{"MYTPP","MAPTM","EGPSD","ESALR","OMSLV"}),{"MYTPP","MAPTM","EGPSD","ESALR","OMSLV"})
 
Upvote 0
Slightly shorter formula where you only have to type in the values once:

=INDEX(B2:F2,AGGREGATE(15,6,MATCH({"MYTPP","MAPTM","EGPSD","ESALR","OMSLV"},B2:F2,0),1))
 
Upvote 0
Thank you very much for your assistance.
I think I will use the aggregate function due to the 'single typing' as this will sit within a erlong formula with the details repeated multiple times.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,091
Latest member
gaurav_7829

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