Search
Clear search
Close search
Google apps
Main menu

MATCH

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

Sample Usage

MATCH("Sunday",A2:A9,0)

MATCH(DATE(2012,1,1),A2:F2)

Syntax

MATCH(search_key, range, search_type)

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

  • range - 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_type - [ 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.

Notes

  • MATCH returns the position in an array or range of a matched value rather than the value itself. To return the value itself or another value corresponding to the row or column the match is found in, use INDEX, HLOOKUP, or VLOOKUP.

See Also

VLOOKUP: Vertical lookup. Searches down the first column of a range for a key and returns the value of a specified cell in the row found.

HLOOKUP: Horizontal lookup. Searches across the first row of a range for a key and returns the value of a specified cell in the column found.

INDEX: Returns the content of a cell, specified by row and column offset.

Examples

Returns the relative position of an item in an array that matches a specified value based on differnet search_type.

Mary is a Docs & Drive expert and author of this help page. Leave her feedback below about the page.

Was this article helpful?
How can we improve it?