The MATCH function is one of Excel’s most powerful, yet frequently misunderstood, tools. While functions like VLOOKUP return the actual data found in a cell, MATCH returns the relative position of a value within a range. On its own, it’s useful. But when combined with other functions (like INDEX), it becomes the backbone of advanced, bulletproof Excel lookups.
Here is everything you need to know to master the MATCH function.
1. The MATCH Function Syntax
The formula is straightforward and takes three arguments:
=MATCH(lookup_value, lookup_array, [match_type])
lookup_value(Required): The value you want to find. (e.g., “Apple”, 42, or a cell reference like D2).lookup_array(Required): The range of cells where you want to search. Note: This must be a single row or a single column.[match_type](Optional): Tells Excel how to match the lookup value. Defaults to1if omitted.
2. Understanding match_type (Crucial!)
This is where most beginners get tripped up. The match_type dictates how Excel searches.
| Match Type | What it does | Requirement |
|---|---|---|
0 | Exact Match. Finds the first value that is exactly equal to lookup_value. | None. Can be unsorted. (Used 95% of the time) |
1 | Less Than. Finds the largest value that is less than or equal to lookup_value. | lookup_array must be sorted in Ascending order (A-Z, 1-10). |
-1 | Greater Than. Finds the smallest value that is greater than or equal to lookup_value. | lookup_array must be sorted in Descending order (Z-A, 10-1). |
💡 Pro Tip: Always explicitly type 0 for an exact match. If you leave it blank, Excel defaults to 1, which will give you incorrect results if your data isn’t sorted!
3. Basic Examples
Example A: Finding a Position (Exact Match)
Imagine you have a list of employees in cells A2:A6:
- Sarah
- John
- Mike
- Emma
Formula: =MATCH("Mike", A2:A6, 0)
Result: 3 (Because Mike is the 3rd item in the range A2:A6).
Example B: Using a Cell Reference
Instead of typing “Mike”, you can reference cell D1 (which contains “Mike”).
Formula: =MATCH(D1, A2:A6, 0)
4. The Power Combo: INDEX + MATCH
By itself, knowing that “Mike” is in position 3 isn’t very useful. But when you combine MATCH with the INDEX function, you create a lookup tool that is vastly superior to VLOOKUP.
- INDEX returns the value at a given position.
- MATCH finds the position.
Syntax:
=INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
Scenario: You want to find the Salary (Column B) of the Employee “Mike” (Column A).
=INDEX(B2:B6, MATCH("Mike", A2:A6, 0))
How it works: MATCH finds that Mike is in position 3. INDEX then goes to the 3rd row of the Salary column and returns his salary.
Why INDEX + MATCH beats VLOOKUP:
- Left Lookups: VLOOKUP can only look to the right. INDEX/MATCH can look left or right.
- Dynamic Columns: If you insert a new column in your data, VLOOKUP breaks (because the column index number is hardcoded). INDEX/MATCH adapts automatically.
- Performance: INDEX/MATCH processes less data and calculates faster on massive spreadsheets.
5. Advanced MATCH Function Techniques
A. Using Wildcards (Partial Matches)
You can use the asterisk (* – matches any sequence of characters) or question mark (? – matches a single character) to find partial matches. This only works with match_type = 0.
Scenario: You want to find the position of a name that starts with “Sm” (could be Smith, Smythe, etc.).
=MATCH("Sm*", A2:A100, 0)
Note: If you need to search for an actual asterisk or question mark, precede it with a tilde (~* or ~?).
B. The Two-Way Lookup (Matrix Lookup)
You can use MATCH twice inside an INDEX function to find a value at the intersection of a specific row and column (like a calendar or a pricing matrix).
Syntax:
=INDEX(data_matrix, MATCH(row_value, row_range, 0), MATCH(col_value, col_range, 0))
How it works: The first MATCH finds the row number, the second MATCH finds the column number, and INDEX returns the exact intersecting value.
6. MATCH vs. XLOOKUP (The Modern Era)
If you are using Excel 2021 or Microsoft 365, you have access to XLOOKUP.XLOOKUP essentially replaces both VLOOKUP and INDEX/MATCH.
- INDEX/MATCH:
=INDEX(B:B, MATCH(D1, A:A, 0)) - XLOOKUP:
=XLOOKUP(D1, A:A, B:B)
Should you still learn MATCH?
Yes. XLOOKUP is not available in older versions of Excel (2019, 2016, etc.), and many corporate environments still use older files. Furthermore, INDEX/MATCH is still required for complex array formulas and two-way matrix lookups in older versions.
7. Troubleshooting Common Errors
| Error | Cause | Solution |
|---|---|---|
#N/A | Excel couldn’t find the lookup_value. | Check for trailing spaces (use TRIM()), ensure spelling is correct, or check if the value actually exists in the array. |
#N/A (with match_type 1 or -1) | Your data is not sorted correctly. | Sort your lookup_array in ascending (for 1) or descending (for -1) order, or just change the match_type to 0. |
| Wrong Result | Data type mismatch. | Excel treats the number 10 and the text "10" differently. Ensure your lookup value and array are formatted as the same data type. |
8. Golden Rules & Best Practices
- Always use
0for exact matches: Make it a habit to type the zero. It prevents silent errors caused by unsorted data. - MATCH is NOT case-sensitive:
=MATCH("apple", ...)and=MATCH("APPLE", ...)will yield the exact same result. If you need a case-sensitive match, you must combine MATCH with theEXACTfunction in an array formula. - Use Excel Tables: If your
lookup_arrayis formatted as an official Excel Table (Ctrl+T), your ranges will automatically expand when you add new data, preventing#N/Aerrors. - Wrap in IFERROR: To make your spreadsheets look clean, wrap your formula in IFERROR to replace
#N/Awith a custom message.- Example:
=IFERROR(MATCH(D1, A:A, 0), "Not Found")
- Example:
Summary
The MATCH function is the ultimate positional tracker in Excel. While it rarely works alone, it is the vital engine behind dynamic lookups. Master the match_type argument, learn to pair it with INDEX, and you will unlock a level of Excel proficiency that puts you in the top tier of spreadsheet users.
