Hello. I am trying to create a formula that will lookup a value from a table based on 2 criteria, but in certain cases I only want 1 criteria. The table would like this...
In cells A1:A5
Blue
Red
Green
*
Black
In cells B1:B5
Dog
Fish
Fish
Fish
Dog
In cells C1:C5
Result1
Result2
Result3
Result4
Result5
If the lookup values were Red and Fish, I want the formula result to be Result2. Green Fish = Result3. Any other color Fish should be Result4.
I couldn't use SUMPRODUCT since I'm looking up text and an Index Match array doesn't recognize the *. So I came up with the following...
=LOOKUP(10^10,SEARCH(A1:A5,A7)*SEARCH(B1:B5,B7),C1:C5)
Cell A7 is the lookup value for column A
Cell B7 is the lookup value for column B
This almost works perfectly except that Red Fish returns Result4 instead of Result2 because the lookup function returns the last match. So, my questions...
1) Is there a way to modify my formula so that it returns the first match?
2) Is there a another formula that would work or a way to do this without the * wildcard?
If not, I think I'll have to invert my table which i'm hoping to avoid.
In cells A1:A5
Blue
Red
Green
*
Black
In cells B1:B5
Dog
Fish
Fish
Fish
Dog
In cells C1:C5
Result1
Result2
Result3
Result4
Result5
If the lookup values were Red and Fish, I want the formula result to be Result2. Green Fish = Result3. Any other color Fish should be Result4.
I couldn't use SUMPRODUCT since I'm looking up text and an Index Match array doesn't recognize the *. So I came up with the following...
=LOOKUP(10^10,SEARCH(A1:A5,A7)*SEARCH(B1:B5,B7),C1:C5)
Cell A7 is the lookup value for column A
Cell B7 is the lookup value for column B
This almost works perfectly except that Red Fish returns Result4 instead of Result2 because the lookup function returns the last match. So, my questions...
1) Is there a way to modify my formula so that it returns the first match?
2) Is there a another formula that would work or a way to do this without the * wildcard?
If not, I think I'll have to invert my table which i'm hoping to avoid.