Skip to content
Google Sheets

MATCH function in Google Sheets

Returns the relative position of an item in a range that matches a specified value.

=MATCH(search_key, range, [search_type])

MATCH syntax and parameters

Three arguments, two required.

  • search_keyanyRequired

    The value to search for. For example, 42, "Cats", or I24.

  • rangerangeRequired

    The one-dimensional array to be searched. If a range with both height and width greater than 1 is used, MATCH will return #N/A!.

  • search_typenumberOptional

    [ OPTIONAL - 1 by default ] - The manner in which to search. 1, the default, causes MATCH to assume that the range is sorted in ascending order and return the largest value less than or equal to search_key. 0 indicates exact match, and is required in situations where range is not sorted. -1 causes MATCH to assume that the range is sorted in descending order and return the smallest value greater than or equal to search_key.

MATCH examples

Formulas you'll actually reuse.

Sample data used in the examples
ABC
1CustomerRegionAmount
2Birch & CoNorth1200
3Acme CorpWest4250
4Delta FoodsSouth860
5Corvus LtdWest2975
6Elm Street BakeryNorth540
  1. The position of a customer in the list — 0 means exact match:

    =MATCH("Acme Corp", A2:A6, 0)

    Result2

  2. INDEX MATCH — MATCH finds the row, INDEX returns the amount from it:

    =INDEX(C2:C6, MATCH("Acme Corp", A2:A6, 0))

    Result4250

  3. Two-way lookup — one MATCH picks the row, a second picks the column:

    =INDEX(A2:C6, MATCH("Corvus Ltd", A2:A6, 0), MATCH("Region", A1:C1, 0))

    Result"West"

  4. Partial match with wildcards — * stands for any run of characters, exact-match type only:

    =MATCH("*bakery*", A2:A6, 0)

    Result5

  5. Which tier band a spend amount falls in — type 1 needs ascending thresholds:

    =MATCH(4250, {0, 1000, 5000, 20000}, 1)

    Result2

MATCH in Excel

Same name — your formula ports as-is.

Try MATCH in the playground

Edit the example — nothing to install.

Preloaded with the MATCH formula from Example 1 — change anything and watch it respond.

Loading the editor…

MATCH common mistakes

Where it usually goes wrong.

  • Leaving out the third argument. MATCH then assumes the range is sorted in ascending order and can return the wrong position without any error. Use 0 unless the data really is sorted.

  • Reading the result as a row number. MATCH returns the position inside the range. A result of 2 for A2:A6 is row 3 of the sheet.

  • Selecting a block of cells. The range has to be a single row or a single column. Anything wider and taller returns #N/A.

  • Comparing text with numbers. The text "1200" does not match the number 1200. Convert one side with VALUE or TO_TEXT.

MATCH errors

What they mean — and the fixes.

  • #N/A

    No match — with type 0 the value must match exactly; TRIM stray spaces, and check that numbers aren't stored as text on one side.