MATCH vs XMATCH in Excel
By ExcelReady TeamUpdated 7 min read
The short answer
Use XMATCH in Excel 2021, Excel 2024 or Microsoft 365: it defaults to an exact match, can search from the last row up, and finds the next smaller or larger value without sorted data. Use MATCH with 0 as its third argument when the file must work in older Excel. Both return a position, usually fed into INDEX.
Key takeaways
- Both return the position of a value in a list, not the value itself.
- XMATCH defaults to an exact match. MATCH defaults to an approximate match, so you must add 0.
- The approximate codes are reversed: MATCH uses 1 for 'next smaller', XMATCH uses -1.
- XMATCH can search from the bottom with search_mode -1 to find the last match.
- MATCH works in every Excel version; XMATCH needs Excel 2021, Excel 2024 or Microsoft 365.
On this page+
MATCH vs XMATCH is the same kind of upgrade as VLOOKUP to XLOOKUP. Both functions return the position of a value in a list, but XMATCH uses an exact match by default, can search from the bottom up, and handles approximate matches without sorted data. MATCH still matters because it works in every version of Excel and appears in countless INDEX MATCH formulas. This guide is for anyone who uses INDEX MATCH or is preparing for an Excel test.
MATCH vs XMATCH at a glance#
XMATCH keeps what MATCH does and fixes its risky default.
| Feature | MATCH | XMATCH |
|---|---|---|
| Syntax | =MATCH(lookup_value, lookup_array, [match_type]) | =XMATCH(lookup_value, lookup_array, [match_mode], [search_mode]) |
| Returns | Position (1 = first item) | Position (1 = first item) |
| Default match | Approximate (1): you must add 0 | Exact (0) |
| Next smaller value | 1, needs data sorted A to Z | -1, any order |
| Next larger value | -1, needs data sorted Z to A | 1, any order |
Wildcards (*, ?) | Automatic with 0 | Only with match mode 2 |
| Search from the bottom (last match) | No | Yes: search mode -1 |
| Not found | #N/A | #N/A |
| Case-sensitive | No | No |
| Excel versions | All versions | Excel 2021, Excel 2024, Microsoft 365 |
What MATCH and XMATCH actually return#
Both return a number: where the value sits in the list, counting from 1. They don't return the value itself. That is why you almost always see them inside INDEX, which takes a position and returns the item there.
Here is a list of sales reps:
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Region | Sales |
| 2 | Ana Lopez | East | 48,200 |
| 3 | Ben Ortiz | West | 61,500 |
| 4 | Cara Singh | East | 39,900 |
| 5 | Dana Kim | South | 72,300 |
| 6 | Eli Brooks | West | 55,100 |
| 7 | Fay Chen | South | 44,800 |
| 8 | Gus Patel | East | 66,700 |
The same lookups, side by side#
Task 1: find a position (exact match)#
=MATCH("Dana Kim",A2:A8,0)
=XMATCH("Dana Kim",A2:A8)Both return 4: Dana Kim is the fourth name in A2:A8 (row 5 of the sheet). MATCH needs the 0 for an exact match. XMATCH does an exact match unless you say otherwise.
If you leave the 0 off MATCH, it does an approximate match. That expects the list to be sorted A to Z. On this unsorted list it can return a wrong position or #N/A, with nothing to warn you.
Task 2: return a value with INDEX#
With a name in F1:
=INDEX(C2:C8,MATCH(F1,A2:A8,0))
=INDEX(C2:C8,XMATCH(F1,A2:A8))For Dana Kim, both return 72,300. The position from MATCH or XMATCH tells INDEX which row of C2:C8 to bring back. Our guide to INDEX MATCH in Excel explains the pattern step by step, including left lookups.
Task 3: find the last match#
Which row holds the last East rep?
=XMATCH("East",B2:B8,0,-1)Search mode -1 searches from the bottom up, so XMATCH returns 7 (Gus Patel). MATCH always searches from the top, so =MATCH("East",B2:B8,0) returns 1 (Ana Lopez), and it has no option to start from the bottom. This is handy for "most recent order" questions when the newest rows are at the bottom.
Task 4: find a tier (approximate match)#
A commission table lists the minimum sales for each tier, sorted from smallest to largest: 0, 10,000, 25,000 and 50,000, in A2:A5. For a sale of 32,000:
=MATCH(32000,A2:A5,1)
=XMATCH(32000,A2:A5,-1)Both return 3, the 25,000 tier. Notice the codes: MATCH uses 1 for "exact or next smaller", but XMATCH uses -1 for the same thing. XMATCH also doesn't need the tiers sorted for this, while MATCH does.
When to use MATCH#
Use MATCH when compatibility matters. It is the better choice when:
- The file must open in Excel 2019 or older. XMATCH shows #NAME? there.
- You are editing a workbook full of INDEX MATCH formulas, and want to keep one style.
- A job test asks for INDEX MATCH by name. It is a classic interview topic; see our list of Excel interview questions.
- You want wildcards with the simplest syntax:
=MATCH("Dana*",A2:A8,0)works directly.
Always write the third argument. Make 0 a habit, and only use 1 or -1 on data you have sorted on purpose. The MATCH function guide covers each match type.
When to use XMATCH#
Use XMATCH for new work when everyone has Excel 2021, Excel 2024 or Microsoft 365. It is the better choice when:
- You want a safe default. Forgetting an argument can't silently switch you to approximate match.
- You need the last match, such as a customer's latest order: search mode
-1. - You need the next smaller or larger value on unsorted data, such as the closest tier or the nearest date.
- You want the position of a calculated value.
=XMATCH(MAX(C2:C8),C2:C8)returns 4, the row of the top seller, ready to feed into INDEX. - You are building a two-way lookup, with one XMATCH for the row and one for the column inside INDEX:
=INDEX(A2:C8,XMATCH("Dana Kim",A2:A8),XMATCH("Sales",A1:C1))The first XMATCH finds the row (4), the second finds the column (3), and INDEX returns 72,300. Change "Sales" to "Region" and the same formula returns South.
Common mistakes with MATCH and XMATCH#
These cause most wrong positions:
- Leaving out MATCH's third argument. The default is approximate match. Add
0. - Mixing up the approximate codes.
1means "next smaller" in MATCH but "next larger" in XMATCH. Check which function you are in before copying a formula. - Expecting XMATCH wildcards by default.
=XMATCH("Dana*",A2:A8)looks for the literal text "Dana*" and returns #N/A. Use=XMATCH("Dana*",A2:A8,2). - A lookup range that doesn't line up with the INDEX range. If MATCH searches A2:A8 but INDEX returns from C3:C9, every result is one row off. Start both ranges on the same row.
- Searching more than one column. Both functions need a single row or a single column.
=MATCH(F1,A2:C8,0)returns #N/A. - Confusing the position with the row number. Dana Kim is at position 4 in A2:A8, but she is on row 5 of the sheet, because the range starts at row 2. Feed the position into INDEX on a range that starts on the same row, rather than using it as a row number.
- Extra spaces or numbers stored as text. "Dana Kim " and "Dana Kim" don't match, and neither do the number 101 and the text "101". Clean the data first.
Do job tests use MATCH or XMATCH?#
Many Excel assessments still test INDEX MATCH, because it works in every version. Some newer tests run on Microsoft 365 and accept XMATCH or XLOOKUP. If the task doesn't name a function and you don't know the version, INDEX(…, MATCH(…, 0)) is the safest answer. If you take the test in Google Sheets or on a Mac, the formulas are the same, but some shortcuts and features differ; see Excel vs Google Sheets for job tests and Excel on Mac vs Windows.
Knowing the syntax is only half of it. In a test you have to type the formula yourself, under time pressure, which is why we argue for hands-on practice over video courses.
Our recommendation#
Learn MATCH first, with 0 every time, because INDEX MATCH is still everywhere and works in any version. Then switch to XMATCH for new files on modern Excel: its exact-match default removes the most common lookup bug, and search mode -1 solves "last match" problems MATCH can't.
In short: MATCH with 0 for compatibility and tests that name it, XMATCH for new files on Excel 2021, Excel 2024 or Microsoft 365.
Practise it#
Solve the INDEX and XMATCH exercise on this page. Then work through the INDEX and MATCH lesson, from a single position to a two-way lookup, and the modern Excel functions lesson, where you use XMATCH alongside SORTBY, TEXTSPLIT and spill references.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Find Dana Kim's sales with INDEX and XMATCH. In F2, use XMATCH to find the position of the name in F1 within A2:A8, and put it inside INDEX on the sales in C2:C8.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Sales | Dana Kim | |||||
| 2 | Sales | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 |
Tip: XMATCH gives the row number of the name. INDEX then returns the sales figure from that row.
Practise this in a lesson
Frequently asked questions
What is the difference between MATCH and XMATCH?
Both find the position of a value in a range. XMATCH defaults to an exact match, can search from last to first, and has a separate wildcard mode. MATCH defaults to an approximate match and works in every version of Excel.
Is XMATCH better than MATCH?
For new files on Excel 2021, Excel 2024 or Microsoft 365, usually yes, because its default is the safe exact match. MATCH is still the right choice when the workbook must open in Excel 2019 or older.
Why does MATCH return the wrong position?
Most often the third argument is missing. Without it, MATCH uses approximate match, which expects sorted data and can return a wrong position on an unsorted list. Add 0 for an exact match.
Does XMATCH support wildcards?
Yes, but only when you set match_mode to 2, as in =XMATCH("Dana*",A2:A8,2). MATCH treats * and ? as wildcards automatically when its third argument is 0.
Can I use XMATCH inside INDEX?
Yes. =INDEX(C2:C8,XMATCH(F1,A2:A8)) works exactly like INDEX MATCH, with an exact match by default.