Forum Discussion

MatthewO2147's avatar
MatthewO2147
Copper Contributor
Mar 24, 2022
Solved

Two Criteria Search

I'm trying to knock some cobwebs off my excel.

I'm attempting to filter an array with 2 input criteria to then search for a designator. 

 

Say I have Locations 

A,B,C,D

And Jobs

1,2,3,4

With People

Bob, Sue, Joe, Fin

 

Arrayed as such

ABCD
1234
BobSueFinBob
 Joe  

 

With say a reference to Job = "1"

Person = "Bob"

 

When putting in said criteria into reference cells,

I'm looking to acquire an output of "A"

So I know if "Bob" is on Job "1", he is at location A.

 

How could I accomplish this?

  • MatthewO2147 

    See screenshot. With the person's name in B6 and the job in B7, the location is returned by

    =IFERROR(INDEX(A1:D1,MATCH(1,((A3:D3=B6)+(A4:D4=B6))*(A2:D2=B7),0)),"-")

    If you don't have Microsoft 365 or Office 2021, confirm the formula with Ctrl+Shift+Enter.

3 Replies

  • MatthewO2147 

    See screenshot. With the person's name in B6 and the job in B7, the location is returned by

    =IFERROR(INDEX(A1:D1,MATCH(1,((A3:D3=B6)+(A4:D4=B6))*(A2:D2=B7),0)),"-")

    If you don't have Microsoft 365 or Office 2021, confirm the formula with Ctrl+Shift+Enter.

    • MatthewO2147's avatar
      MatthewO2147
      Copper Contributor
      Okay I see how this works, thank you.
      Small question though,
      When adding people into the table, would I have to add another line to the Match.
      With it currently (A3:D3=B6)+(A4:D4=B6) would I then have to add (A5:D5=B6) to make the formula account for the new row? or is there a way to have it account for an entire array of A3:D5?