The MATCH function
MATCH doesn't return the value it finds; it returns *where* it is. In a list of five teams, MATCH("Oakbrook",…) gives 3 if Oakbrook is third.
On its own that's handy for positions. Paired with INDEX, it becomes a flexible lookup that can return a value from any column, including ones to the left.
=MATCH(lookup_value, lookup_array, [match_type])
Arguments
- lookup_value
- What to find.
- lookup_array
- A single row or column to search.
- match_typeoptional
- 0 for an exact match. 1 (the default) finds the largest value less than or equal to it in an ascending list; -1 the smallest value greater than or equal to it in a descending list.
Try it
=MATCH("Oakbrook",A2:A6,0) in D2. Oakbrook is the 3rd item in A2:A6, so MATCH gives 3.
D2
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Team | Points | Oakbrook position | ||
| 2 | Riverside | 42 | 3 | ||
| 3 | Hillford | 39 | |||
| 4 | Oakbrook | 35 | |||
| 5 | Marsh Lane | 31 | |||
| 6 | Kingsway | 28 | |||
| 7 | |||||
| 8 |
Edit the formula in D2, or change the data, and press Enter.
More examples
| Formula | Result | What it does |
|---|---|---|
| =MATCH("Hill*",A2:A6,0) | 2 | Exact match allows wildcards: the first team starting with Hill. |
| =MATCH(36,B2:B6,-1) | 2 | The points are in descending order, so -1 finds the smallest value that's still at least 36: Hillford's 39. |
| =INDEX(B2:B6,MATCH("Marsh Lane",A2:A6,0)) | 31 | MATCH finds the row, INDEX returns the points from it. |
| =MATCH("Ashby",A2:A6,0) | #N/A | Not in the list. |
Tips
- Always type the
0for an exact match unless you're deliberately using sorted bands. - The position counts from the start of the range, not the sheet. If the range starts at row 2, position 1 is row 2.
- MATCH also works across a row, which lets INDEX pick the column by its heading.
Common mistakes
- MATCH returns a wrong position, with no error.The third argument is missing, so it defaults to 1 (approximate), which expects a sorted list. Add
,0. - #N/A appears.The value isn't there exactly: check for spaces, or a number that's stored as text on one side.
- MATCH on a block of several columns gives #N/A.
lookup_arraymust be one row or one column. Search just the column that holds the value.
Practise MATCH with instant feedback
Type real formulas into a working spreadsheet and get told straight away whether they work.