XLOOKUP Multiple Criteria — With Examples (Boolean Logic, Concatenation, OR)
Learn XLOOKUP with multiple criteria in Excel: Boolean logic, concatenation, helper columns and OR logic, with worked examples.
Read Guide →XLOOKUP is Excel’s modern lookup function, and it does what VLOOKUP does with fewer ways to go wrong. You give it three things — the value to find, the range to search, and the range to return from — and it finds the match and returns the answer. Exact match is the default, it looks left or right, and it has a built-in answer for when the value is not there. It is not in every Excel: it needs Microsoft 365, Excel 2021 or Excel 2024, and it does not exist in Excel 2019 or earlier, or in Google Sheets. This guide teaches it in nine examples, all on the same table, with every answer checked by hand — and it ends with the honest cases where VLOOKUP is still the right call.
Quick takeaway: three arguments do the job; the other three are for the hard cases.
=XLOOKUP(102, A2:A5, D2:D5) — find 102 in A2:A5, return the matching price from D2:D5. Answer: 399.
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
| Argument | Required? | What it does |
|---|---|---|
| lookup_value | Yes | The value to search for — a number, text, or a cell reference |
| lookup_array | Yes | The range to search in |
| return_array | Yes | The range to return the answer from |
| if_not_found | No | What to show when there is no match (instead of #N/A) |
| match_mode | No | 0 = exact (default), −1 = next smaller, 1 = next larger, 2 = wildcard |
| search_mode | No | 1 = search from the first (default), −1 = search from the last |
Three arguments do the job. The last three are for the hard cases: not found, approximate match, and last match. Learn the first three, then add the others one at a time.
The same four-row product table from the XLOOKUP vs VLOOKUP guide — so every answer here matches that guide exactly.
| A | B | C | D | E |
|---|---|---|---|---|
| SKU | Product | Category | Price | Stock |
| 101 | Laptop Stand | Accessories | 45 | 120 |
| 102 | Standing Desk | Furniture | 399 | 12 |
| 103 | Office Chair | Furniture | 249 | 30 |
| 104 | Monitor Arm | Accessories | 89 | 75 |
=XLOOKUP(102, A2:A5, D2:D5)
Search A2:A5 for 102, return the matching item from D2:D5: 399. That is the whole job — three arguments, one answer, exact match by default. No FALSE to remember, no column to count.
VLOOKUP cannot do this at all, because the price sits to the right of the product name. XLOOKUP does not care which side the answer is on — the lookup range and the return range are separate.
=XLOOKUP(399, D2:D5, B2:B5)
Search D2:D5 for 399, return the matching product from B2:B5: “Standing Desk”. The lookup range (prices, column D) is to the right of the return range (products, column B), and XLOOKUP handles it the same way.
=XLOOKUP(999, A2:A5, D2:D5, "Not found")
SKU 999 is not in the table. Without the fourth argument, XLOOKUP returns #N/A. With it, it returns “Not found” — a message your reader understands, instead of an error code. Use a number instead of text when the result feeds another calculation: =XLOOKUP(999, A2:A5, D2:D5, 0).
The return range can be more than one column. XLOOKUP returns the whole row at once, spilled across the cells.
=XLOOKUP(102, A2:A5, B2:E5)
Result, spilled across four cells: Standing Desk | Furniture | 399 | 12. One formula, four answers, and they stay in step with the table — change the price and the spilled result changes with it.
XLOOKUP looks from the top and returns the first match by default. Its search_mode argument can scan from the bottom up with −1, returning the last match. VLOOKUP cannot do this at all.
Example: an order log where the same customer appears several times. Ali’s orders: 100, then 150, then 175. To find Ali’s last order:
=XLOOKUP("Ali", A2:A6, B2:B6, , , -1)
Result: 175 — the last Ali in the list, not the first (100). Note the two empty arguments: the fourth (if_not_found) and fifth (match_mode) are left blank with two commas, so the −1 lands in the sixth argument, search_mode.
Sometimes you do want an approximate match — the next smaller or next larger value. XLOOKUP’s match_mode handles it: −1 for next smaller, 1 for next larger, and it works on unsorted data.
| Threshold | Discount |
|---|---|
| 0 | 0% |
| 100 | 5% |
| 500 | 10% |
| 1,000 | 15% |
An order of 750 falls in the 500–999 band, so the discount is 10%:
=XLOOKUP(750, A2:A5, B2:B5, , -1)
Result: 10%. The −1 means “exact or next smaller”: 750 is not in the list, so XLOOKUP takes 500, the largest value below it, and returns 10%. VLOOKUP’s approximate match only works when the first column is sorted in ascending order — on unsorted data it returns wrong results without warning. So if you need an approximate match, XLOOKUP is not just easier, it is safer.
You remember part of a product name, not the whole thing. Set match_mode to 2 for a wildcard match, and use * for “anything”:
=XLOOKUP("*Stand*", B2:B5, D2:D5, , 2)
Result: 45 — the first product whose name contains “Stand” is the Laptop Stand (SKU 101), and its price is 45. The * on both sides means “anything before and after”. Without the 2, XLOOKUP looks for the literal text “Stand” and finds nothing.
Find a value by its row AND its column — a product and a quarter, and the number where they meet. The inner XLOOKUP finds the column, the outer one finds the row.
| Q1 | Q2 | |
|---|---|---|
| Laptop Stand | 120 | 145 |
| Standing Desk | 12 | 18 |
The sales of the Standing Desk in Q2:
=XLOOKUP("Standing Desk", A2:A3, XLOOKUP("Q2", B1:C1, B2:C3))
Check it: the inner XLOOKUP(“Q2”, B1:C1, B2:C3) returns the Q2 column, {145, 18}. The outer XLOOKUP(“Standing Desk”, A2:A3, {145, 18}) returns 18 — the second row, which is the Standing Desk. One formula, no helper cells.
Find the price of the Furniture item with stock above 20. Two tests, one lookup:
=XLOOKUP(1, (C2:C5="Furniture")*(E2:E5>20), D2:D5)
Check it: the Furniture rows are 102 (stock 12) and 103 (stock 30). Only 103 passes both tests — Furniture AND stock above 20 — so the result is 249, the price of the Office Chair. The trick is the 1: each test gives TRUE or FALSE, multiplying them gives 1 only where both are true, and XLOOKUP finds the 1.
| Version | XLOOKUP? |
|---|---|
| Microsoft 365 | Yes |
| Excel 2021 | Yes |
| Excel 2024 | Yes |
| Excel for the web | Yes |
| Excel 2019 | No |
| Excel 2016 | No |
If the file must open in Excel 2019 or earlier, do not use XLOOKUP — the people opening it will see #NAME? instead of an answer. Use INDEX+MATCH instead: the same job in two steps, and it works in every version. That is the one case where the older function wins.
No. Google Sheets does not have XLOOKUP. If you paste an XLOOKUP formula into Sheets, it shows #NAME?. In Sheets, use VLOOKUP or INDEX+MATCH for the same job — or the FILTER function when you need every matching row. This is an Excel site, so the Sheets versions are not taught here; the point is to stop you pasting the wrong formula into the wrong app.
| Mistake | What happens | Fix |
|---|---|---|
| You used XLOOKUP in Excel 2019 | #NAME? — the function does not exist in your version | Use INDEX+MATCH, or upgrade to Microsoft 365 |
| You left out the return range | #VALUE! — XLOOKUP needs all three required arguments | Add the return range: =XLOOKUP(value, lookup_range, return_range) |
| The lookup value is a number, the column is text | #N/A — 102 and “102” are different values to a lookup | Make both the same type; check for text with ISTEXT |
| You forgot the empty commas before search_mode | The −1 lands in match_mode, not search_mode | Write both commas: =XLOOKUP("Ali", A2:A6, B2:B6, , , -1) |
| You used match_mode 2 without wildcards | #N/A — mode 2 expects * or ? in the value | Add the asterisks: "*Stand*", or drop the 2 |
| You copied the formula down without locking the ranges | The ranges move with the formula and the answers go wrong | Lock them: =XLOOKUP(A2, $A$2:$A$5, $D$2:$D$5) — see the absolute reference guide |
| The spilled row has #SPILL! | Something is in the way of the spilled cells | Clear the cells to the right of the formula |
What is XLOOKUP in Excel? A lookup function that searches one range for a value and returns the matching item from another range. Syntax: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]).
How do I use XLOOKUP in Excel? Type =XLOOKUP(, then the value to find, the range to search, and the range to return from, then close the bracket. For example: =XLOOKUP(102, A2:A5, D2:D5) returns 399.
What is the difference between XLOOKUP and VLOOKUP? XLOOKUP searches one range and returns from another, so it looks left or right and survives column inserts; VLOOKUP searches the first column of a range and counts across, so it only looks right and breaks on inserts. XLOOKUP matches exactly by default; VLOOKUP needs FALSE written every time.
Does XLOOKUP work in Excel 2019? No. XLOOKUP needs Microsoft 365, Excel 2021 or Excel 2024. In Excel 2019 or earlier, use INDEX+MATCH.
How do I find the last match with XLOOKUP? Set search_mode to −1: =XLOOKUP("Ali", A2:A6, B2:B6, , , -1). The two empty commas keep the −1 in the sixth argument.
How do I return multiple values with XLOOKUP? Give it a return range wider than one column — =XLOOKUP(102, A2:A5, B2:E5) spills the whole row. For every matching row (not one match), use the FILTER function instead.
Can XLOOKUP do a partial match? Yes — set match_mode to 2 and use wildcards: =XLOOKUP("*Stand*", B2:B5, D2:D5, , 2).
Does Google Sheets have XLOOKUP? No. Sheets does not have XLOOKUP. Use VLOOKUP or INDEX+MATCH in Sheets.
That is XLOOKUP: three arguments for the everyday job, three more for the hard cases — not found, approximate match, last match — and nine examples on one table to prove each one works. It is simpler than VLOOKUP and safer than VLOOKUP, and for most people on Microsoft 365 it should be the default lookup. The two exceptions are worth remembering: if the file must open in Excel 2019, use INDEX+MATCH, and if you are in Google Sheets, XLOOKUP does not exist at all. Try it on your own table now, with the product table above, and when you want the four lookup functions compared side by side, the Excel lookup functions topic page is next — and the Excel Formulas hub has the full learning order for the whole site.
Learn XLOOKUP with multiple criteria in Excel: Boolean logic, concatenation, helper columns and OR logic, with worked examples.
Read Guide →Learn the MATCH function in Excel: exact and approximate matches, wildcards, INDEX MATCH lookups, two-way lookups and XMATCH.
Read Guide →Learn the UNIQUE function in Excel: distinct values from a column, exactly once, sorted, blank-free, counted and combined.
Read Guide →