MATCH
Find the position of a value in a range or array with Excel's MATCH function.
Spreadsheet editor
Spreadsheet editor
Syntax
=MATCH(lookup_value, lookup_array, [match_type])
Returns: Number Arguments
| Argument | Required | Description |
|---|---|---|
| lookup_value | Yes | The value to search for. Can be a number, text, logical value, or a cell reference. |
| lookup_array | Yes | The single row or column of cells to search in. |
| match_type | No | How to match: 0 for an exact match, 1 (default) for the largest value less than or equal to lookup_value, or -1 for the smallest value greater than or equal to it. |
About
Reach for MATCH when you care about where something is, not just whether it exists. It really shines paired with INDEX, where MATCH finds the row or column number and INDEX pulls the value from it. This INDEX/MATCH combo is a flexible alternative to VLOOKUP because it can look left as well as right and does not break when you insert columns.
If you have a newer version of Excel, XMATCH is an upgraded version of MATCH with extra search options, and XLOOKUP can often replace the INDEX/MATCH pattern altogether.
Exercises using MATCH
INDEX-MATCH left lookup
IntermediateFind a customer's email address where email is to the LEFT of customer ID.
Open exerciseINDEX-MATCH with MATCH in both directions
IntermediateUse INDEX with two MATCH functions to return a value from a shipping rate grid.
Open exerciseLook up a manager with INDEX+MATCH
IntermediateLook up an employee's manager using INDEX-MATCH (lookup value not in first column).
Open exerciseTwo-way lookup
AdvancedFind the price at the intersection of product and region in a matrix.
Open exerciseExamples
Look up a price with INDEX and MATCH
Spreadsheet editor
Place a score into a grade band
Spreadsheet editor
Handle a missing value without errors
Spreadsheet editor
Watch out for
Forgetting the match_type and getting wrong results
If you leave match_type blank, it defaults to 1, which assumes your data is sorted in ascending order. On unsorted data this returns a position that looks valid but is wrong.
→ Add 0 as the third argument for an exact match whenever your list is not sorted: =MATCH(value, range, 0). Make it a habit unless you specifically need a range lookup.
Getting #N/A when the value should be there
MATCH returns #N/A when it cannot find the lookup value. Often the culprit is extra spaces, numbers stored as text, or a slight spelling difference.
→ Check for stray spaces with TRIM and confirm both sides are the same data type. To show a friendly message instead of the error, wrap it in IFERROR.
Searching a two-dimensional range
MATCH only works on a single row or single column. Passing a block like A1:D10 returns an error or unexpected results.
→ Point lookup_array at one row or one column only. To find a value across both rows and columns, run two MATCH formulas and feed them into INDEX.