Excel functions · Lookup
MATCH function in Excel
MATCH returns the position of a value in a column or row: if "P-104" is the 4th item in the list, MATCH returns 4. It's most often paired with INDEX to build a lookup, and it needs 0 as its third argument for an exact match.
Last reviewed
Syntax
=MATCH(lookup_value, lookup_array, [match_type])- lookup_valuerequired
- The value whose position you want. Text can use * and ? wildcards with match_type 0.
- lookup_arrayrequired
- A single column or row to search.
- match_typeoptional
- 0 exact match. 1 (the default) finds the largest value less than or equal to lookup_value and needs ascending order. -1 finds the smallest value greater than or equal to it and needs descending order.
- The default is 1, not exact match. Type the 0.
- It returns a position within the range, not a sheet row number.
- Matching ignores case.
Which versions have MATCH
Every current Excel version: Microsoft 365, Excel for the web, Excel 2024, 2021, 2019 and 2016, on Windows and Mac.
| Version | Has it |
|---|---|
| Microsoft 365 (Windows and Mac) | Yes |
| Excel for the web | Yes |
| Excel 2024 | Yes |
| Excel 2021 | Yes |
| Excel 2019 | Yes |
| Excel 2016 | Yes |
Google Sheets
Google Sheets has MATCH with the same arguments; its search_type also defaults to 1.
Examples
The examples use this sample sheet.
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | SKU | Product | Category | Price |
| 2 | P-101 | Desk lamp | Office | 24.50 |
| 3 | P-102 | Monitor stand | Office | 39.00 |
| 4 | P-103 | USB-C hub | Electronics | 45.00 |
| 5 | P-104 | Webcam | Electronics | 69.00 |
| 6 | P-105 | Desk chair | Furniture | 189.00 |
| 7 | P-106 | Footrest | Furniture | 32.00 |
1.Find the position of a SKU
=MATCH("P-104", A2:A7, 0)Result: 4
P-104 is the 4th SKU in A2:A7.
2.Wildcard match
=MATCH("Desk*", B2:B7, 0)Result: 1
"Desk*" matches any name starting with Desk; Desk lamp comes first, at position 1.
3.Two-way lookup with INDEX
=INDEX(A2:D7, MATCH("P-106", A2:A7, 0), MATCH("Price", A1:D1, 0))Result: 32.00
One MATCH finds the row (6), the other finds the Price column (4), and INDEX returns the cell where they meet.
Common errors and fixes
| Error | Why it happens | Fix |
|---|---|---|
| #N/A | No match, or match_type was left out on unsorted data. | Use 0 as match_type for an exact match, and check for extra spaces or numbers stored as text. |
Do it with GPTExcel
Skip writing MATCH by hand
Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.
Find which column holds 'Net revenue' in each sheet and pull that column into one table.
Done. I used MATCH on your sheet and checked the results against your data.
- Written for your platform and version
- Checked against your actual data
- Newest functions looked up in official docs
MATCH questions
- What does the 0 in MATCH mean?
- 0 asks for an exact match. Without it MATCH uses 1, an approximate match that assumes the list is sorted ascending, which can return the wrong position.
- What's the difference between MATCH and XMATCH?
- XMATCH matches exactly by default, can search from the last item to the first, and works on unsorted data for next-smaller or next-larger matches. MATCH works in every Excel version; XMATCH needs Microsoft 365 or Excel 2021 or later.
Skip the formula hunt
Upload a spreadsheet and ask in plain English. Free plan, no credit card.
Start free