Lookup With Multiple Criteria in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
To look up a value that must match two or more criteria, multiply the tests and look up 1: =XLOOKUP(1,(A2:A8=F2)(B2:B8=F3),C2:C8). Each test gives 1 for TRUE and 0 for FALSE, so only rows that pass every test become 1. In Excel 2019 and earlier, use =INDEX(C2:C8,MATCH(1,(A2:A8=F2)(B2:B8=F3),0)) or a helper column.
Key takeaways
- Multiply tests to make AND logic: (A2:A8=F2)*(B2:B8=F3) is 1 only where both match.
- =XLOOKUP(1,tests,return_range) returns the first row where every test is TRUE.
- INDEX MATCH with MATCH(1,tests,0) does the same in older Excel, entered with Ctrl+Shift+Enter in 2019 and earlier.
- A helper column that joins the keys, such as =A2&"|"&B2, works with VLOOKUP in every version.
- If the result is a number and each combination is unique, SUMIFS is the simplest option.
On this page+
- Why a normal lookup isn't enough
- How to do a lookup with multiple criteria using XLOOKUP
- XLOOKUP with joined keys: another way
- How to do it with INDEX and MATCH (older Excel)
- How to do it with a helper column (any version)
- The SUMIFS shortcut for numbers
- Common mistakes in multiple-criteria lookups
- Practise it
A lookup with multiple criteria finds the row where two or more columns all match, such as the price of a Hoodie in size M. Normal VLOOKUP and XLOOKUP only search one column, so you combine the criteria first. This guide shows the modern XLOOKUP method, the INDEX MATCH version for older Excel, a helper column that works everywhere, and when SUMIFS is simpler still.
Why a normal lookup isn't enough#
A normal lookup stops at the first row that matches one value, which is often the wrong row. Here is a price list where the same product appears in several sizes:
| A | B | C | |
|---|---|---|---|
| 1 | Product | Size | Price |
| 2 | T-shirt | S | 12 |
| 3 | T-shirt | M | 13 |
| 4 | T-shirt | L | 14 |
| 5 | Hoodie | S | 30 |
| 6 | Hoodie | M | 32 |
| 7 | Hoodie | L | 34 |
| 8 | Cap | One size | 15 |
F2 holds Hoodie and F3 holds M. =XLOOKUP(F2,A2:A8,C2:C8) returns 30, the price of the first Hoodie row (size S). You need a lookup that checks the product and the size.
How to do a lookup with multiple criteria using XLOOKUP#
Look up the number 1 in an array built by multiplying the tests:
=XLOOKUP(1,(A2:A8=F2)*(B2:B8=F3),C2:C8)The result is 32. Here is what happens, row by row:
| Row | A2:A8=F2 | B2:B8=F3 | Multiplied |
|---|---|---|---|
| T-shirt S | FALSE | FALSE | 0 |
| T-shirt M | FALSE | TRUE | 0 |
| Hoodie S | TRUE | FALSE | 0 |
| Hoodie M | TRUE | TRUE | 1 |
| Hoodie L | TRUE | FALSE | 0 |
When you multiply TRUE and FALSE values, Excel treats TRUE as 1 and FALSE as 0. Only a row that passes both tests gives 1 × 1 = 1. XLOOKUP then finds the first 1 and returns the price from that row.
Add a third test by multiplying again, for example *(D2:D8="Blue"). Each test must be wrapped in its own brackets, and every range must have the same number of rows. Add the optional fourth argument to show a message instead of #N/A: =XLOOKUP(1,(A2:A8=F2)*(B2:B8="XL"),C2:C8,"Not found") returns Not found. XLOOKUP needs Excel 2021, Microsoft 365 or Excel for the web; the XLOOKUP function guide covers its other arguments.
You can also return more than one column. Make the return array wider, for example =XLOOKUP(1,(A2:A8=F2)*(B2:B8=F3),B2:C8), and the result spills across two cells: the size and the price of the matching row. Leave the cell to the right empty so the result has room.
XLOOKUP with joined keys: another way#
You can also join the criteria into one text key with &, on both sides:
=XLOOKUP(F2&"|"&F3,A2:A8&"|"&B2:B8,C2:C8)F2&"|"&F3 becomes Hoodie|M, and A2:A8&"|"&B2:B8 builds the same kind of key for every row. The result is again 32.
The | separator matters. Without it, "AB" + "C" and "A" + "BC" would both become "ABC" and could match the wrong row. The multiplication method avoids that problem and also handles conditions such as C2:C8>=32, which joined keys can't, so it's usually the better choice.
How to do it with INDEX and MATCH (older Excel)#
In Excel 2019 and earlier, use the same multiplied tests inside MATCH:
=INDEX(C2:C8,MATCH(1,(A2:A8=F2)*(B2:B8=F3),0))MATCH finds the position of the first 1 (row 5 of the range), and INDEX returns the 5th price: 32. The 0 at the end of MATCH means exact match.
In Excel 2019 and earlier, this is an array formula: press Ctrl+Shift+Enter instead of Enter (on a Mac, ⌃⇧Return also works). Excel shows curly braces around it in the formula bar. In Excel 2021 and Microsoft 365, a normal Enter is enough. If INDEX MATCH is new to you, start with the INDEX MATCH guide, which explains each part on a single criterion.
How to do it with a helper column (any version)#
A helper column joins the criteria on the sheet, so a plain VLOOKUP can search it.
Step 1: Add a key column on the left#
Insert a column before the table, or use a spare column at the left. In it, type =A2&"|"&B2 and fill down. Each row now has a key such as Hoodie|M.
Step 2: Look up the joined value#
If the key is in column A and the price is now in column D, use:
=VLOOKUP(F2&"|"&F3,A2:D8,4,FALSE)This works in every version of Excel, and anyone can see how it works by looking at the key column. The cost is an extra column to maintain.
The SUMIFS shortcut for numbers#
If the value you want is a number, and each combination appears only once, SUMIFS gives the same answer without any array logic:
=SUMIFS(C2:C8,A2:A8,F2,B2:B8,F3)The result is 32. Be careful, though: if a combination appears twice, SUMIFS adds both prices instead of returning one, and if there's no match it returns 0 instead of an error. Use it only when you're sure the combinations are unique.
Common mistakes in multiple-criteria lookups#
- Using AND instead of
*.AND(A2:A8=F2,B2:B8=F3)returns one TRUE or FALSE for the whole range, so the lookup fails. - Forgetting the brackets around each test.
A2:A8=F2*B2:B8=F3is calculated in the wrong order. - Ranges of different sizes, such as A2:A8 and B2:B9, which return #VALUE!.
- Numbers stored as text, so a test like
A2:A8=101finds nothing. Make both sides the same type. - Expecting every match. These formulas return the first matching row only. To list all matches, see return every match for a lookup with FILTER. To get the most recent match instead of the first, see find the last match with XLOOKUP.
Multiple-criteria lookups are a common step up in interviews and data tests, after a basic VLOOKUP; see the Excel interview questions and the Excel skills for data analysts.
Practise it#
Try the live exercise on this page to find the Hoodie M price. Then practise INDEX and MATCH in a live spreadsheet to see how position-based lookups work, and use the XLOOKUP lesson to get quick with the modern syntax before combining criteria.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Prices depend on both product and size. In G2, use XLOOKUP to return the price for the product in F2 and the size in F3. Look up 1 in (A2:A8=F2)*(B2:B8=F3) and return from C2:C8.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Price | Price | ||||||
| 2 | Hoodie | |||||||
| 3 | M | |||||||
| 4 | ||||||||
| 5 | ||||||||
| 6 | ||||||||
| 7 | ||||||||
| 8 | ||||||||
| 9 | ||||||||
| 10 | ||||||||
| 11 |
Tip: The lookup value is 1. The lookup array is the two tests in brackets, multiplied. The return array is C2:C8.
Practise this in a lesson
Frequently asked questions
Can XLOOKUP use multiple criteria?
Yes. Use 1 as the lookup value and multiply the tests as the lookup array: =XLOOKUP(1,(A2:A8=F2)*(B2:B8=F3),C2:C8). It works in Excel 2021, Microsoft 365 and Excel for the web.
Can VLOOKUP look up with two criteria?
Not on its own. Add a helper column that joins the two keys, such as =A2&"|"&B2, put it first in the table, and look up F2&"|"&F3 with VLOOKUP.
Why use multiplication instead of AND?
AND returns one TRUE or FALSE for the whole range, not one result per row. Multiplying two ranges of TRUE/FALSE gives a 1 or 0 for each row, which is what the lookup needs.
What happens if more than one row matches all the criteria?
XLOOKUP and INDEX MATCH return the first matching row. To get every match, use FILTER instead; to get the last one, use XLOOKUP with search_mode -1.
Do I need Ctrl+Shift+Enter for a multiple-criteria lookup?
Only for the INDEX MATCH version in Excel 2019 and earlier. In Excel 2021 and Microsoft 365, press Enter as normal.