XLOOKUP With Multiple Criteria
By ExcelReady TeamUpdated 6 min read
The short answer
XLOOKUP has no separate argument for a second condition, so you combine the criteria yourself. Either join them: =XLOOKUP(G2&"|"&H2,A2:A8&"|"&B2:B8,C2:C8), or multiply tests and look up 1: =XLOOKUP(1,(A2:A8=G2)*(B2:B8=H2),C2:C8). Both return the first row where every condition is true. XLOOKUP needs Excel 2021 or Microsoft 365.
Key takeaways
- Join method: look up G2&"|"&H2 in A2:A8&"|"&B2:B8. Easy to read, exact matches only.
- Boolean method: look up 1 in (A2:A8=G2)*(B2:B8=H2). It also handles conditions like >= and <.
- Add a separator such as "|" when joining, so AB + C and A + BC don't look the same.
- Use the 4th argument for a friendly message when no row meets every condition.
- XLOOKUP needs Excel 2021 or Microsoft 365. In older versions, use INDEX and MATCH with the same logic.
On this page+
- Why XLOOKUP needs a trick for multiple criteria
- Method 1: Join the criteria with &
- Method 2: Multiply TRUE/FALSE tests and look up 1
- Which method should you use?
- Handle no match and return more than one column
- OR logic, last match and older versions of Excel
- Common mistakes with XLOOKUP and multiple criteria
- Practise it
XLOOKUP with multiple criteria works by combining the conditions into one lookup. You either join the values with &, or multiply TRUE/FALSE tests and look up the number 1. Both find the first row where every condition is true, such as the price of a Hoodie in size M. This guide shows each method step by step on a small price list, when to use which, and how to handle no match.
Why XLOOKUP needs a trick for multiple criteria#
XLOOKUP looks for one value in one list. Its syntax has no slot for a second condition:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])When the item you want is defined by two columns, neither column alone is enough. In this price list, "Hoodie" appears three times and "M" appears twice, but "Hoodie and M" appears once:
| A | B | C | |
|---|---|---|---|
| 1 | Product | Size | Price |
| 2 | T-shirt | S | 12 |
| 3 | T-shirt | M | 14 |
| 4 | T-shirt | L | 15 |
| 5 | Hoodie | S | 30 |
| 6 | Hoodie | M | 32 |
| 7 | Hoodie | L | 35 |
| 8 | Cap | One size | 10 |
A plain =XLOOKUP("Hoodie",A2:A8,C2:C8) returns 30, the first Hoodie, whatever the size. The XLOOKUP guide covers the single-condition basics, and the XLOOKUP function guide lists every argument.
All examples below have the product to find in G2 (Hoodie) and the size in H2 (M).
Method 1: Join the criteria with &#
The simplest method joins the criteria into one text value, and joins the columns the same way:
=XLOOKUP(G2&"|"&H2,A2:A8&"|"&B2:B8,C2:C8)It returns 32. Here is how it works:
G2&"|"&H2becomes the single value Hoodie|M.A2:A8&"|"&B2:B8builds a list on the fly: T-shirt|S, T-shirt|M, T-shirt|L, Hoodie|S, Hoodie|M, and so on.- XLOOKUP finds Hoodie|M in position 5 and returns the 5th price, 32.
The | in the middle is a separator. Without it, different pairs can join into the same text: "AB" plus "C" and "A" plus "BC" both become "ABC". Pick any character that never appears in your data.
This method is easy to read and works for exact matches. It turns numbers into text as it joins them, which is fine as long as you join both sides the same way.
Method 2: Multiply TRUE/FALSE tests and look up 1#
The second method tests each condition separately, then combines the results:
=XLOOKUP(1,(A2:A8=G2)*(B2:B8=H2),C2:C8)It also returns 32. Step by step:
(A2:A8=G2)checks every product against Hoodie and gives a list of TRUE and FALSE: FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE.(B2:B8=H2)checks every size against M: FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE.- Multiplying them turns TRUE into 1 and FALSE into 0, and gives 1 only where both are true: 0, 0, 0, 0, 1, 0, 0.
- XLOOKUP looks for 1 in that list, finds it in position 5 and returns 32.
The brackets around each test are required. Add a third condition by multiplying again: (A2:A8=G2)*(B2:B8=H2)*(C2:C8>20).
Which method should you use?#
Both give the same answer for exact matches. Choose by the kind of conditions you have:
| Need | Join with & | Multiply tests |
|---|---|---|
| Exact matches on two or three columns | Yes, easiest to read | Yes |
Conditions like >=, < or <> | No | Yes: (C2:C8>=20) |
| OR logic (this or that) | No | Yes, with + |
| Easy for others to follow | Yes | Takes a moment to explain |
Use the join method when every condition is "equals". Use the multiply method when any condition compares sizes, dates or amounts. For example, the first Hoodie that costs more than 31:
=XLOOKUP(1,(A2:A8="Hoodie")*(C2:C8>31),B2:B8)This returns M, the size of the first row that passes both tests.
Handle no match and return more than one column#
If no row meets every condition, XLOOKUP returns #N/A. Use the 4th argument to show a message instead:
=XLOOKUP(G2&"|"&H2,A2:A8&"|"&B2:B8,C2:C8,"Not found")With Cap and M in G2 and H2, this shows Not found. The guide to XLOOKUP if not found has more options.
To bring back several columns at once, make the return array wider. If the list had a Stock column in D, C2:D8 as the return array would spill the price and the stock side by side. See XLOOKUP with multiple columns for this. The same formulas also work when the price list is on another sheet; just include the sheet name in each range, as shown in XLOOKUP from another sheet.
OR logic, last match and older versions of Excel#
A few variations cover most remaining cases:
- OR logic. Add the tests instead of multiplying them, then check for more than 0:
=XLOOKUP(1,--((A2:A8="Cap")+(B2:B8="L")>0),C2:C8)returns 15, the first row that is a Cap or size L. - Last match. Set the 6th argument to -1 to search from the bottom up:
=XLOOKUP(1,(A2:A8="Hoodie")*(C2:C8<40),C2:C8,,0,-1)returns 35. - Older Excel. XLOOKUP needs Excel 2021, Excel 2024 or Microsoft 365. In older versions, use INDEX and MATCH with the same multiply logic:
=INDEX(C2:C8,MATCH(1,(A2:A8=G2)*(B2:B8=H2),0)). In Excel 2019 and earlier, confirm it with Ctrl+Shift+Enter (on a Mac, Control+Shift+Return or ⌘+Shift+Return). The guide to lookups with multiple criteria compares every method, including a helper column.
Common mistakes with XLOOKUP and multiple criteria#
These cause most #N/A results and wrong answers:
- Joining only one side. If you join G2 and H2 but not the columns, nothing matches. Join both the same way, with the same separator.
- Ranges of different sizes.
A2:A8withB2:B9returns #VALUE!. Keep every range on the same rows. - Hidden spaces. "Hoodie " with a trailing space doesn't equal "Hoodie". Clean the data with TRIM.
- Missing brackets around tests.
A2:A8=G2*B2:B8=H2is read in the wrong order. Write(A2:A8=G2)*(B2:B8=H2). - Numbers vs text. A size typed as the number 10 doesn't equal the text "10". Make both sides the same type.
Practise it#
The join method uses two skills at once: XLOOKUP and joining text. Practise XLOOKUP in a live spreadsheet: you look up in any direction and add a friendly not-found message, and each formula is checked instantly. Then build joined keys with & in the joining text lesson. Start with the Hoodie price in the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Find the price of a Hoodie in size M. The product is in G2 and the size in H2. In I2, use XLOOKUP and join the two criteria with &"|"&.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Price | Price | ||||||||
| 2 | M | |||||||||
| 3 | ||||||||||
| 4 | ||||||||||
| 5 | ||||||||||
| 6 | ||||||||||
| 7 | ||||||||||
| 8 | ||||||||||
| 9 | ||||||||||
| 10 | ||||||||||
| 11 |
Tip: The lookup value is G2&"|"&H2. The lookup array joins the columns the same way: A2:A8&"|"&B2:B8. Return C2:C8.
Practise this in a lesson
Frequently asked questions
Can XLOOKUP have multiple criteria?
Yes, but not as separate arguments. Combine the criteria by joining them with &, or multiply TRUE/FALSE tests and look up the number 1. Both work in a normal formula in Excel 2021 and Microsoft 365.
How do I use XLOOKUP with two conditions?
Use =XLOOKUP(1,(A2:A8=G2)*(B2:B8=H2),C2:C8). Each test gives TRUE or FALSE for every row, multiplying them gives 1 only where both are true, and XLOOKUP returns the price from that row.
Why does my XLOOKUP with multiple criteria return #N/A?
No row meets every condition. Check for extra spaces, numbers stored as text, and ranges of different sizes. Add a 4th argument such as "Not found" to show a message instead of #N/A.
Is XLOOKUP with multiple criteria slow?
On normal sheets, no. On tens of thousands of rows with many such formulas, a helper column that joins the keys once can be faster, because the joined list isn't rebuilt in every formula.