Find if two values occur (regardless of order) in a row of range... simple formula right?

hinsdale1

Board Regular
Joined
Oct 7, 2011
Messages
60
ABDEFGHI
SmithJonesWhiteJonesTrue
JonesSmithTrue
SmithJohnson
Group1Group2Group3Group4

<tbody>
</tbody>

I am trying to lookup values A1 & B1 (Smith & Jones) to find the row in range D:E where both values occur regardless of order (can be Jones/Smith or Smith/Jones).

...and... if this matching row has a value of True in Table to right (columns F:I ), return the Group name of the column which is True.

Desired result for data above: For Smith & Jones - matches row 2 of range D:E - this row has a value of True in column G and would return the result of "Group2"


I will also need to adapt the formula for three values lookup for matches in a 3 column range.

It seems like would be pretty straightforward but my brain seems to be broken today.. any help is much appreciated!
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi

Plenty of smart ways to do this in a single cell but I think the easiest and clearest would be with a helper column as follows to return TRUE or FALSE. This is easy to adapt to 3 values, just add another COUNTIF().

Code:
=AND(COUNTIF(D2:E2,$A$2),COUNTIF(D2:E2,$B$2))

Then to return Group2 where the group names are in F5:I5 and your blank and TRUE values are in F2:I4:

Code:
=INDEX(F5:I5,MATCH(TRUE,INDEX(F2:I4,MATCH(TRUE,C2:C4,0),0),0))

Hope that helps

Mackers
 
Last edited:
Upvote 0
Mackers.. it works perfectly.. and you made my day! I really appreciate you taking the time to help out.. you're a scholar and a gentleman.
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,189
Members
449,090
Latest member
bes000

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