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 →VLOOKUP gives you a value. MATCH gives you a position. =MATCH("Priya", A2:A11, 0) does not return “Priya” — it returns 2, because Priya is the second rep in the list. That number is the point: feed it to INDEX and you get any value from that row, in any direction VLOOKUP cannot go. This guide gives you that function first, then runs it on the ten-order sales table, so you can check each answer yourself — exact match, approximate match in both directions, wildcards, the two-column check, and the INDEX MATCH combination — plus the one warning that matters: if you leave the match type out, it defaults to 1, and on unsorted data it returns a plausible wrong answer.
Quick takeaway: MATCH answers “which row is this in?” — INDEX answers “what is in that row?”
=MATCH(lookup_value, lookup_array, [match_type]) — the value, one row or one column, and the match type.
=MATCH(lookup_value, lookup_array, [match_type])
| Argument | Required | What it does |
|---|---|---|
| lookup_value | Yes | The value to find — a number, text, a logical value, or a cell reference to one of these |
| lookup_array | Yes | The range to search. It must be a single row or a single column — a two-dimensional range returns #N/A |
| match_type | No | 0 exact, 1 approximate ascending, -1 approximate descending. Defaults to 1 if you leave it out |
The position MATCH returns is relative to the range, not to the worksheet. In the table below, “Priya” is in worksheet row 3, but =MATCH("Priya", A2:A11, 0) returns 2 — she is the second item in the range A2:A11. That is the number INDEX needs.
Every example below uses the same ten-order sales table from the COUNTIF, SUMIF and UNIQUE articles — Rep, Region, Sales, Order Date, Status, Notes — in rows 2 to 11. Every result was checked against it.
| Formula | Result | Why |
|---|---|---|
=MATCH("Priya", A2:A11, 0) | 2 | Priya is the second rep in the range |
=MATCH(2400, C2:C11, 0) | 3 | 2400 is the third sales figure |
=MATCH("East", B2:B11, 0) | 1 | East is the first region — row 2 is East |
=MATCH("Alex", A2:A11, 0) | 1 | Alex appears three times, and MATCH always returns the first match |
=MATCH(999, C2:C11, 0) | #N/A | 999 is not in the Sales column |
=MATCH("Central", B2:B11, 0) | #N/A | Central is not in the Region column |
=MATCH("A*", A2:A11, 0) | 1 | The wildcard * matches any characters — Alex is first |
=MATCH("J*", A2:A11, 0) | 3 | Jordan is the third rep |
Read the rows. MATCH scans from the top and stops at the first equal value, so duplicates always return the first occurrence — Alex is at positions 1, 5 and 10, and MATCH returns 1. And the two #N/A rows are the honest answers: the value is not there, so there is no position to return. Wrap the formula in IFERROR or ISNUMBER when you need a word instead of an error — =IF(ISNUMBER(MATCH(999, C2:C11, 0)), "Yes", "No") gives “No”.
| match_type | Meaning | Sort order required | Typical use |
|---|---|---|---|
| 0 | Exact match. Returns the position of the first cell equal to lookup_value. | None | IDs, names, codes; almost every lookup |
| 1 (default) | Approximate. Returns the position of the largest value less than or equal to lookup_value. | Ascending | Tax slabs, grade bands, commission tiers |
| -1 | Approximate. Returns the position of the smallest value greater than or equal to lookup_value. | Descending | Thresholds listed high to low, such as discount cut-offs |
Take the grade thresholds 0, 60, 70, 80, 90 — sorted ascending — and run all three types on the same scores:
| Score | =MATCH(score, thresholds, 1) | =MATCH(score, thresholds, 0) | What it means |
|---|---|---|---|
| 59 | 1 | #N/A | 0 is the largest value ≤ 59; 59 is not in the list |
| 78 | 3 | #N/A | 70 is the largest value ≤ 78 — the C band |
| 90 | 5 | 5 | 90 is the largest value ≤ 90, and it is also an exact match |
| 95 | 5 | #N/A | 90 is the largest value ≤ 95; 95 is not in the list |
The same score, two different answers — and both are right, for their match type. The approximate match does not look for the score; it looks for the band the score falls in. And the descending version, on thresholds listed high to low — 90, 80, 70, 60, 0 — gives the mirror image: =MATCH(78, thresholds, -1) returns 2, because 80 is the smallest value greater than or equal to 78.
Leave match_type out and it defaults to 1. On sorted data that is fine. On unsorted data it returns a plausible but wrong position — because with match_type 1 or -1 Excel uses a binary search, which assumes the data is sorted. Run it on the unsorted Sales column and watch: =MATCH(2400, C2:C11) — no third argument — does not return 3. The binary search halves the list, compares the middle, and lands on a position that looks normal but is not the row with 2400. The fix is one character: always pass 0 unless you specifically need a range match. =MATCH(2400, C2:C11, 0) returns 3, every time.
MATCH finds the position; INDEX returns the value at that position. Use the shared product table from the lookup articles — SKU 101 Laptop Stand £45, 102 Standing Desk £399, 103 Office Chair £249, 104 Monitor Arm £89 — in rows 2 to 5, SKU in column A and Price in column D:
| Formula | Result | Why |
|---|---|---|
=MATCH(102, A2:A5, 0) | 2 | SKU 102 is the second item |
=INDEX(D2:D5, 2) | 399 | The second price is 399 |
=INDEX(D2:D5, MATCH(102, A2:A5, 0)) | 399 | MATCH supplies the 2, INDEX returns the price |
=INDEX(B2:B5, MATCH(102, A2:A5, 0)) | Standing Desk | The same position, the Product column |
=INDEX(D2:D5, MATCH(999, A2:A5, 0)) | #N/A | 999 is not in the SKU column, so MATCH has no position to give |
That is the whole pattern: MATCH answers “which row”, INDEX answers “what is in that row”. Unlike VLOOKUP it works in any direction — the lookup column does not have to be first — and unlike XLOOKUP it works in every version of Excel, including 2019 and earlier.
One MATCH gives the row; a second MATCH gives the column. Take the rep-by-region sales grid — reps in A2:A5 (Alex, Priya, Jordan, Sam), regions in B1:E1 (East, West, North, South), totals in B2:E5:
| Formula | Result | Why |
|---|---|---|
=MATCH("Jordan", A2:A5, 0) | 3 | Jordan is the third rep |
=MATCH("East", B1:E1, 0) | 1 | East is the first region |
=INDEX(B2:E5, MATCH("Jordan", A2:A5, 0), MATCH("East", B1:E1, 0)) | 2400 | Row 3, column 1 — Jordan’s East sales |
=INDEX(B2:E5, MATCH("Priya", A2:A5, 0), MATCH("West", B1:E1, 0)) | 850 | Row 2, column 2 — Priya’s West sales |
=INDEX(B2:E5, MATCH("Sam", A2:A5, 0), MATCH("North", B1:E1, 0)) | 450 | Row 4, column 3 — Sam’s North sales |
Change the two input cells and the answer changes — the same formula answers any rep and any region, with no helper column.
Two keywords in this group ask for a yes-or-no answer, and MATCH is the test: wrap it in ISNUMBER and the result is a word, not a position.
| Formula | Result | Why |
|---|---|---|
=IF(ISNUMBER(MATCH(102, A2:A5, 0)), "Yes", "No") | Yes | SKU 102 is in the list |
=IF(ISNUMBER(MATCH(999, A2:A5, 0)), "Yes", "No") | No | SKU 999 is not in the list |
=IF(ISNUMBER(MATCH(A2, B2:B11, 0)), "Match", "No match") | — | True when the value in A2 appears anywhere in column B — drag it down to check a whole column |
That last row is the two-column check: for each value in one column, MATCH tests whether it appears in the other, and ISNUMBER turns the position or the #N/A into a word. Use it to check a list of SKUs against a master list, or a list of emails against a list of subscribers.
Excel 365 and Excel 2021 add XMATCH, which is MATCH with exact match as the default and a search-from-last option:
| Formula | Result | Why |
|---|---|---|
=XMATCH(102, A2:A5) | 2 | Exact match by default — no third argument needed |
=XMATCH("Alex", A2:A11, 0, -1) | 10 | Search from last — Alex’s last occurrence, not his first |
=XMATCH(999, C2:C11, 0, 1, "Not found") | Not found | The fifth argument replaces #N/A with a word |
Use XMATCH when the workbook will only ever open in Microsoft 365 or Excel 2021 and later. Use MATCH when the workbook must open in Excel 2019 or earlier, or when you need a position rather than a value — and XLOOKUP, which combines INDEX and MATCH into one function with an exact match by default, when you want the value directly and do not need the position at all.
| Mistake | What happens | Fix |
|---|---|---|
| You left match_type out | Defaults to 1 — on unsorted data, a plausible wrong position | Always pass 0 unless you need a range match |
| You searched a two-dimensional range | #N/A — MATCH needs one row or one column | Search one row or one column only |
| You used match_type 1 on unsorted data | A plausible but wrong position | Sort the array ascending, or use 0 |
| You used match_type -1 on ascending data | A plausible but wrong position | Sort the array descending, or use 0 |
| You expected the value, not the position | A number like 2 instead of “Priya” | Pair it with INDEX, or use XLOOKUP for the value |
| You expected the last match | MATCH always returns the first match | Use XMATCH with search from last |
| You compared text with different case | No problem — text comparison is not case-sensitive | Nothing to fix — “east” matches “East” |
What does the MATCH function return in Excel? A position number, not the value. =MATCH("Priya", A2:A11, 0) returns 2, because Priya is the second item in the range. The number is relative to the range, not to the worksheet.
What is the difference between match type 0, 1 and -1? 0 is exact match — the first cell equal to the lookup value, no sorting needed. 1 is approximate — the largest value less than or equal to the lookup value, array sorted ascending. -1 is approximate — the smallest value greater than or equal to the lookup value, array sorted descending.
Why does my MATCH return #N/A when the value is right there? Either the value is not in the range — check for a trailing space, or a number stored as text — or you searched a two-dimensional range, which MATCH cannot do.
Why does MATCH return the wrong position? You left match_type out, so it defaulted to 1, and the array is not sorted ascending. Pass 0 for an exact match.
How do I use INDEX and MATCH together? =INDEX(D2:D5, MATCH(102, A2:A5, 0)) — MATCH finds the position of SKU 102 (2), and INDEX returns the second price (399).
How do I check if two columns match? =IF(ISNUMBER(MATCH(A2, B2:B11, 0)), "Match", "No match") — true when the value in A2 appears anywhere in column B.
What is XMATCH? MATCH with exact match as the default and a search-from-last option, in Microsoft 365 and Excel 2021 and later. Use it when the workbook will not open in older Excel.
That is the MATCH function in Excel: =MATCH(lookup_value, lookup_array, [match_type]) — the value, one row or one column, and the match type — and it returns a position, not a value, so Priya is 2, 2400 is 3, and Alex is 1 even though he appears three times. On the tables in this guide, that one function answers every question: exact match with 0 gives the first hit, approximate match with 1 gives the band a score falls in — 78 sits in the 70 band, position 3 — and approximate match with -1 gives the mirror image on descending thresholds. Remember the two things that catch everyone once: if you leave match_type out it defaults to 1, and on unsorted data that returns a plausible wrong answer — so always pass 0 unless you need a range match — and MATCH on its own only gives you the position; pair it with INDEX to get the value, which is how the price of SKU 102 comes out as 399. From here, the next functions worth learning are the ones this one sits next to — the XLOOKUP function for the one-function version of the same lookup, the VLOOKUP formula for the older way — and the full learning order for the whole site is on the Excel Formulas hub and the Lookup topic page.
Learn XLOOKUP with multiple criteria in Excel: Boolean logic, concatenation, helper columns and OR logic, with worked examples.
Read Guide →Learn the UNIQUE function in Excel: distinct values from a column, exactly once, sorted, blank-free, counted and combined.
Read Guide →Learn the INDIRECT function in Excel: turn text into a live cell reference, pull from a sheet named in a cell, and...
Read Guide →