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.

MATCH availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019Yes
Excel 2016Yes

Google Sheets

Google Sheets has MATCH with the same arguments; its search_type also defaults to 1.

Examples

The examples use this sample sheet.

Products (A1:D7)
RowABCD
1SKUProductCategoryPrice
2P-101Desk lampOffice24.50
3P-102Monitor standOffice39.00
4P-103USB-C hubElectronics45.00
5P-104WebcamElectronics69.00
6P-105Desk chairFurniture189.00
7P-106FootrestFurniture32.00
  1. 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. 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. 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

MATCH errors, causes and fixes
ErrorWhy it happensFix
#N/ANo 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.

your-file.xlsx

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.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

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