INDEX and MATCH with multiple criteria
To lookup values with INDEX and MATCH, using multiple criteria, you can use an array formula. In the example shown, the formula in H8 is:
Note: this is an array formula, and must be entered with control + shift + enter.
How this formula works
Normally, an INDEX MATCH formula is configured with MATCH set to look through a one-column range and provide a match based on given criteria. Without concatenating values in a helper column, or in the formula itself, there's no way to supply more than one criteria.
This formula works around this limitation by using boolean logic to create an array of ones and zeros to represent rows matching all 3 criteria, then using MATCH to match the first 1 found. The temporary array of ones and zeros is generated with this snippet:
Here we compare the item H5 against all items, the size in H6 against all sizes, and the color in H7 against all colors. The initial result is three arrays of TRUE FALSE results like this:
The math operation (multiplication) transforms the TRUE FALSE values to 1s and 0s:
After multiplication, we have a single array like this:
which is fed into the MATCH function as the lookup array, with a lookup value of 1:
At this point, the formula is a standard INDEX MATCH formula. The MATCH function returns 3 to INDEX:
and INDEX returns a final result of $17.00.
It is possible to add another INDEX to this formula, avoiding the need to enter as an array formula with control + shift + enter:
The INDEX function can handle arrays natively, so the second INDEX is added only to "catch" the array created with the boolean logic operation and return the same array again to MATCH. To do this, INDEX is configured with zero rows and one column. The zero row trick causes INDEX to return column 1 from the array (which is already one column anyway).