Google Sheets MATCH Formula: Syntax, Examples & Fixes

How-to basics · Updated November 21, 2026

In Google Sheets, use =MATCH(search_key, range, 0) to find an exact match and return its position in a range. MATCH returns a number indicating where the item appears within the range—not the matching value itself.

What the MATCH function does

MATCH searches a single row or column for a value and reports its relative position. That position is counted from the first cell in the range you supplied, not from the top of the worksheet. If the value is in the third cell of the range, MATCH returns 3, even if that cell happens to be in row 12.

For example, imagine a list of products in A2:A6: Apples, Bananas, Mangoes, Oranges, and Pears. With product names in A2:A6, the formula =MATCH("Mangoes",A2:A6,0) returns 3 because Mangoes is the third item in that range. The result is not the worksheet row number, which is 4, and it is not the word Mangoes.

This makes MATCH useful when another formula needs a position, particularly INDEX. It can also help check whether an item appears in a list, identify the location of a heading, or find which entry corresponds to a key in a table.

MATCH syntax and its arguments

The full syntax is MATCH(search_key, range, [search_type]). The square brackets indicate that search_type is optional; they are part of the syntax description, not something to type into a formula. Google Sheets accepts comma-separated arguments.

  • search_key is the value to look for. It may be a number, text, date, or a reference to a cell containing the value.
  • range is the one-dimensional row or column to search. MATCH is not designed to search a two-dimensional block as a grid.
  • search_type sets how the function compares values. Use 0 for an exact match, 1 for an ascending approximate match, or -1 for a descending approximate match.

If you leave out search_type, Google Sheets uses 1. That default can produce an unexpected result when a list is not sorted, so it is generally clearer and safer to specify 0 when you want an exact match.

Find an exact match

For ordinary list lookups, use 0 as the third argument. With customer IDs in A2:A20 and the ID to find in E2, the formula =MATCH(E2,A2:A20,0) returns the position of that ID within A2:A20. If E2 matches the value in A7, the result is 6: A7 is the sixth cell in the selected range.

Exact match is appropriate for identifiers, product names, category labels, and other values where a nearby value is not an acceptable substitute. If no matching value exists, MATCH returns the #N/A error. That error means the requested match was not found under the comparison rules used by the formula; it does not necessarily mean the spreadsheet is broken.

MATCH is not case-sensitive for ordinary text comparisons. For example, a search for “north” can match “North.” If capitalization must distinguish entries, MATCH by itself is not enough; a case-sensitive lookup requires a different approach using functions such as EXACT with an array-based formula.

When search_type is 0, text search keys can also use wildcards: an asterisk represents any number of characters, and a question mark represents one character. A tilde can be used to search for a literal wildcard character. For instance, if product names are in A2:A10, =MATCH("*tea*",A2:A10,0) finds the position of the first name containing “tea.” Wildcards are helpful for flexible text searches, but they are not a substitute for exact IDs or codes.

Understand approximate matching

The other two search types are for ordered data. With 1, MATCH assumes the range is sorted in ascending order and returns the position of the largest value that is less than or equal to the search key. If values in B2:B6 are 50, 60, 70, 80, and 90, then =MATCH(68,B2:B6,1) returns 2: the largest listed value no greater than 68 is 60, in the second position.

With -1, MATCH assumes the range is sorted in descending order and returns the position of the smallest value that is greater than or equal to the search key. If C2:C6 contains 100, 90, 80, 70, and 60, then =MATCH(75,C2:C6,-1) returns 3 because 80 is the smallest listed value that is still at least 75.

Approximate modes are useful for thresholds, graded bands, or commission tables where a value should map to the nearest eligible bracket. The sort order is essential: ascending for 1 and descending for -1. If a range is unsorted, the result can be wrong or surprising. For names and unsorted lists, use 0 instead.

Combine MATCH with INDEX

MATCH locates an item; INDEX returns a value from a range at a specified position. Together, they make a flexible lookup. Suppose product names are in A2:A6 and their prices are in B2:B6, with Mangoes in A4 and its price of 1.25 in B4. With those ranges as described, =INDEX(B2:B6,MATCH("Mangoes",A2:A6,0)) returns 1.25. MATCH finds position 3 in the product list, and INDEX returns the third value in the price list.

The two ranges must line up in the same order and have corresponding entries. If the product list starts at A2 but the price range starts at B3, the position will refer to the wrong price. Check that both ranges cover the same records before relying on the result.

You can use a cell reference as the search key and show a friendly message if the item is missing. With product names in A2:A6, prices in B2:B6, and the requested product in E2, =IFNA(INDEX(B2:B6,MATCH(E2,A2:A6,0)),"Not found") returns the matching price or the words Not found when MATCH produces #N/A. IFNA handles that particular error; it does not hide unrelated errors elsewhere in a formula.

Common MATCH problems and how to fix them

The most common issue is #N/A even though a value appears to be present. Compare the search key and list carefully. Extra spaces, punctuation, different number formats, or a number stored as text can make two values look alike while Sheets treats them as different. For text imported from another system, TRIM can remove ordinary leading and trailing spaces, but it will not fix every kind of hidden character.

  • Check the range: Make sure it includes the cell containing the intended match and is only one row or column.
  • Set the match mode: Add 0 for an exact lookup instead of relying on the default approximate mode.
  • Compare data types: A numeric ID stored as text may not match the same-looking numeric value. Convert or standardize the source data where appropriate.
  • Look for duplicates: MATCH returns the position of the first matching occurrence in the search direction. It does not list every duplicate.
  • Inspect sorting: If using 1 or -1, verify that the range is sorted in the required order and that new rows have not disrupted that order.

A second common misunderstanding is expecting MATCH to return the content of the matching cell. It returns a position. If you need the value from a related column, pair it with INDEX as shown above, or use a lookup function designed to return a corresponding result.

MATCH compared with other lookup options

INDEX and MATCH are useful when you want to keep the search column and result column separate, especially when the result is to the left of the search column. The combination also makes the position-finding step visible and can be adapted to return values from different columns by changing the INDEX range.

Google Sheets also has XLOOKUP, which can search a range and return a corresponding value directly, so a separate MATCH position is not always necessary for a straightforward lookup. VLOOKUP is another familiar option, but it is structured around searching the first column of a selected table and returning a value from a column to its right. Choose based on the shape of the data and whether you need the position itself.

MATCH remains a good choice when you need a position for another calculation, want to locate a label in a header row, or are building an INDEX-based formula. In Microsoft Excel, MATCH has the same basic role and similar syntax, though spreadsheet features and interface details can vary by version. This article’s formulas and examples are for Google Sheets in a web browser.

Frequently Asked Questions

Does MATCH return the value or its position?
MATCH returns the value’s relative position within the range. Use INDEX with MATCH if you want to return a related value from another range.

How do I make MATCH look for an exact value?
Set the third argument to 0. For example, with the search list in A2:A20 and the lookup value in E2, use =MATCH(E2,A2:A20,0).

Why does MATCH return #N/A?
Usually, no value meets the formula’s match rules. Check the selected range, match type, spaces, punctuation, and whether numbers and text have been stored consistently.

Can MATCH find partial text?
Yes. In exact-match mode, text search keys can use * for any number of characters and ? for one character. A wildcard search can return the first matching position, so confirm that this is suitable if several entries could match.

Does MATCH return the first duplicate?
Yes. When there are repeated exact matches, MATCH returns the position of the first occurrence it encounters in the range. It does not return all matching positions.

Can MATCH search across both rows and columns?
A MATCH range should be a single row or a single column. To search a two-dimensional table, choose the relevant row or column, or combine lookups designed for the table’s layout.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.