Google Sheets function · Lookup
MATCH in Google Sheets: syntax and examples
MATCH looks for a key in one row or column and returns its position, counted from 1. It rarely works alone: INDEX turns that position into a value. Put 0 as the last argument when you want an exact match.
Syntax
MATCH(search_key, range, [search_type])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
search_key | any | yes | The value to find. Text, number or a cell reference. |
range | range | yes | One row or one column to search in. A two-dimensional range gives #N/A. |
search_type | number | no | 0 for an exact match. 1 (default) finds the largest value that is not above the key, on ascending data. -1 does the opposite on descending data. |
Examples
The examples use this table, starting in A1:
| SKU | Product | Price | Stock |
| A-100 | Desk lamp | 34 | 12 |
| A-200 | Office chair | 79.9 | 0 |
| B-300 | Monitor stand | 129.5 | 7 |
| B-400 | Cable tray | 549 | 40 |
=MATCH("B-300", A2:A5, 0)Result: 3
Position of a SKU in the list. 0 means exact match.
Run in a Google Sheet (English US locale) on .
=MATCH(100, C2:C5, 1)Result: 2
Approximate match on ascending prices: the largest price not above 100 is 79.9, in position 2.
Run in a Google Sheet (English US locale) on .
=MATCH("B-*", A2:A5, 0)Result: 3
A wildcard with exact mode finds the first code that starts with B-.
Run in a Google Sheet (English US locale) on .
=INDEX(B2:B5, MATCH("B-400", A2:A5, 0))Result: Cable tray
The classic pair: MATCH gives the row, INDEX returns the product from it.
Run in a Google Sheet (English US locale) on .
=MATCH("b-300", A2:A5, 0)Result: 3
Lowercase key against uppercase data still matches: the search ignores case.
Run in a Google Sheet (English US locale) on .
Common errors
- Leaving search_type out means 1, an approximate match that assumes ascending data. On unsorted data it can return a wrong position with no error.
- A key that is not found gives #N/A. With 1, the same happens when the key is smaller than the first item.
- The range must be a single row or column. A two-column range such as A2:B5 returns #N/A, even if the key is there.
- Wildcards (* and ?) only work with search_type 0. With 1, the key "B-*" is not expanded and returns 2 instead of 3. A key that contains a literal * needs ~ in front of it.
Compared with Excel
MATCH takes the same three arguments in Excel and defaults to 1 there too.