Try this:
=LOOKUP(2,1/((B8:B17=G7)*(C8:C17=G8)),D8:D17)
Please help me with Vlookup and Match functions. I have attached a sample file with data.
I used this formula from one of the questions from this forum and I get #N/A
VLOOKUP(G7,$B$8:$D$17,MATCH(G8,C8:D17,0),0)
Thanks
The lookup_value (2) is greater than all the values in the lookup_vector (which it will be, because of the 1/ before the lookup_vector).
We use a lookup_value of 2 because we know that the result of this expression:
1/((B8:B17=G7)*(C8:C17=G8))
will not return a value greater than 1. Therefore, the lookup_value 2 is guaranteed to be greater than all the 1s in the lookup_vector.
The position of the 1 result in the lookup_vector matches the position of the item we are looking for in the result_vector.
Use the Evaluate Formula feature on the Formulas ribbon to step through the formula and see it working.
Another Option using sumproduct
=SUMPRODUCT(($B$8:$B$17 = G7) * ($C$8:$C$17 = G8), D8:D17)
The lookup_value (2) is greater than all the values in the lookup_vector (which it will be, because of the 1/ before the lookup_vector).
We use a lookup_value of 2 because we know that the result of this expression:
1/((B8:B17=G7)*(C8:C17=G8))
will not return a value greater than 1. Therefore, the lookup_value 2 is guaranteed to be greater than all the 1s in the lookup_vector.
The position of the 1 result in the lookup_vector matches the position of the item we are looking for in the result_vector.
Use the Evaluate Formula feature on the Formulas ribbon to step through the formula and see it working.
a couple more alternatives
to confirm with CSE
=INDEX(D8:D17,MATCH(G7&G8,B8:B17&C8:C17,0))
or without
=INDEX(D8:D17,AGGREGATE(14,6,ROW(D8:D17)/((B8:B17=G7)*(C8:C17=G8)),1)-7,0)
1] If you want to use VLOOKUP (), try this array formula :
=VLOOKUP(G7,IF(C8:C17=G8,B8:D17),3,0)
p.s. array formula : to be confirmed enter with CTRL+SHIFT+ENTER (CSE) instead of just ENTER
2] Or this without CSE :
=SUMIFS(D:D,B:B,G7,C:C,G8)
Regards
Bosco
a couple more alternatives
to confirm with CSE
=INDEX(D8:D17,MATCH(G7&G8,B8:B17&C8:C17,0))
or without
=INDEX(D8:D17,AGGREGATE(14,6,ROW(D8:D17)/((B8:B17=G7)*(C8:C17=G8)),1)-7,0)
If you want to use AGGREGATE(), INDEX() can be removed and formula become :
=AGGREGATE(14,,(B8:B17=G7)*(C8:C17=G8)*D8:D17,1)
Regards
Bosco