MATCH vs XMATCH
Updated · Works in: Excel 2021+, Microsoft 365 · not Google Sheets (no XMATCH) · Every example checked before release
Short answer
MATCH(value, range, 0) returns a position in every Excel version and Google Sheets. XMATCH(value, range) defaults to exact match and can search from the end, but needs Excel 2021 or later and isn't in Google Sheets.
Use MATCH with 0 as its third argument if the file might be opened in Google Sheets or older Excel; use XMATCH in Excel 2021 or later when you need to search from the end. Both return where a value sits in a range: 1 for the first cell, 2 for the second. XMATCH defaults to an exact match; MATCH defaults to an approximate one.
| MATCH | XMATCH | |
|---|---|---|
| Default match | Approximate (needs sorted data) | Exact |
| Search from the last row | No | Yes, search mode -1 |
| Excel | Every version | Excel 2021, 2024, Microsoft 365 |
| Google Sheets | Yes | No |
The same position, two ways
Where is “Ceramic pot” in the product list? MATCH(M1, H2:H8, 0) and XMATCH(M1, H2:H8) both return 5. The difference is the 0: MATCH needs it for an exact match, and XMATCH doesn't.
| G | H | I | J | K | L | M | |
|---|---|---|---|---|---|---|---|
| 1 | SKU | Product | Price | Stock | Product | Ceramic pot | |
| 2 | PL-101 | Fern | $9.50 | 40 | Position | 5 | |
| 3 | PL-104 | Monstera | $34.00 | 12 | |||
| 4 | PL-107 | Snake plant | $22.00 | 25 | |||
| 5 | PT-210 | Terracotta pot | $12.50 | 60 | |||
| 6 | PT-212 | Ceramic pot | $19.00 | 18 | |||
| 7 | TL-301 | Watering can | $18.00 | 9 | |||
| 8 | SL-401 | Potting mix | $7.25 | 80 |
The last match: only XMATCH
Mara Okafor ordered twice. MATCH always finds the first: row 1 of the customer list. XMATCH with search mode -1 searches from the bottom: XMATCH(K1, C2:C13, 0, -1) returns 6, her latest order (the rows are in date order). Use the position with INDEX to fetch that order's details.
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | Date | Customer | Product | Category | Qty | Price | Status | Customer | Mara Okafor | |
| 2 | 1001 | 2 Mar 2026 | Mara Okafor | Monstera | Plants | 1 | $34.00 | Shipped | Last order row | 6 | |
| 3 | 1002 | 2 Mar 2026 | Jonas Lind | Terracotta pot | Pots | 3 | $12.50 | Shipped | |||
| 4 | 1003 | 3 Mar 2026 | Priya Raman | Snake plant | Plants | 2 | $22.00 | Shipped | |||
| 5 | 1004 | 4 Mar 2026 | Tomás Ruiz | Watering can | Tools | 1 | $18.00 | Pending | |||
| 6 | 1005 | 5 Mar 2026 | Elif Demir | Fern | Plants | 4 | $9.50 | Shipped | |||
| 7 | 1006 | 5 Mar 2026 | Mara Okafor | Potting mix | Soil | 2 | $7.25 | Returned | |||
| 8 | 1007 | 6 Mar 2026 | Kenji Mori | Pruning shears | Tools | 1 | $24.00 | Shipped | |||
| 9 | 1008 | 7 Mar 2026 | Ines Varga | Ceramic pot | Pots | 2 | $19.00 | Pending | |||
| 10 | 1009 | 8 Mar 2026 | Jonas Lind | Monstera | Plants | 1 | $34.00 | Shipped | |||
| 11 | 1010 | 9 Mar 2026 | Sofia Rossi | Fern | Plants | 6 | $9.50 | Shipped | |||
| 12 | 1011 | 10 Mar 2026 | Priya Raman | Potting mix | Soil | 5 | $7.25 | Shipped | |||
| 13 | 1012 | 11 Mar 2026 | Leo Brandt | Snake plant | Plants | 1 | $22.00 | Pending |
Google Sheets and older Excel
XMATCH is missing from Google's function list, and Microsoft marks it as new in Excel 2021, so a file that uses it shows #NAME? in Google Sheets and in Excel 2019 or older. MATCH works everywhere. In Excel 2021 or later, XLOOKUP with search mode -1 returns the last match's value directly; see XLOOKUP vs INDEX MATCH.
Which should a beginner learn first?
MATCH, always with 0 as the third argument, because it works in both apps and in every version, and it's the half of INDEX MATCH you'll use most. Add XMATCH later for last-match and wildcard searches if your Excel has it.
Check yourself
One real exercise from the “Lookups” unit. Checked on our server; no account needed.In which position of the price list is the product in M1? Use MATCH on the Product column and put the answer in M2.
- Use MATCH
| A | B | C | D | E | F | G | H | I | J | K | L | M | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | SKU | Qty | SKU | Product | Price | Stock | Product | Ceramic pot | ||||
| 2 | 2001 | PL-104 | 2 | PL-101 | Fern | $9.50 | 40 | Position | |||||
| 3 | 2002 | PT-210 | 1 | PL-104 | Monstera | $34.00 | 12 | ||||||
| 4 | 2003 | TL-301 | 3 | PL-107 | Snake plant | $22.00 | 25 | ||||||
| 5 | 2004 | PL-101 | 1 | PT-210 | Terracotta pot | $12.50 | 60 | ||||||
| 6 | 2005 | SL-401 | 4 | PT-212 | Ceramic pot | $19.00 | 18 | ||||||
| 7 | 2006 | PL-104 | 1 | TL-301 | Watering can | $18.00 | 9 | ||||||
| 8 | 2007 | PT-212 | 2 | SL-401 | Potting mix | $7.25 | 80 | ||||||
| 9 | 2008 | PL-107 | 1 |
Common mistakes
Leaving out MATCH's third argument, which defaults to approximate match and returns wrong positions on unsorted data.
Using XMATCH in a file shared with Google Sheets users.
Expecting a row number on the sheet: both return the position inside the range, so H5 is position 4 of H2:H8.
Questions
Does MATCH return the row number?+
It returns the position within the range you give it. For the sheet's row number, add the number of rows above the range.
Can MATCH find the last match?+
Not directly. In Excel 2021 or later use XMATCH or XLOOKUP with search mode -1.
Reading is step one. Now make it stick.
Practise it in a five-minute lesson on a live sheet, with instant feedback. No account needed for the free units.
Sources
Official documentation the facts on this page were checked against.