MATCH

Get the relative position of a specified search key in a one-dimensional range of cells.

Parameter List

Syntax
MATCH(search_keyrange
[search_type]
)
search_key

The value to search for. For example: "Super" or 123.

range

The one-dimensional range of cells or JSON data in which to search for the search_key. For example: A1:A6.

[optional] search_type

The way to search. For example 0. By default set to 1. For more information, click here.

More details

The way to search.

  • Use 1 when the range is sorted in ascending order and you want the position of the largest value that is less than or equal to the search_key.

  • Use 0 when you want the the first exact match in ascending order.

  • Use -1 when the range is sorted in descending order and you want the smallest value that is greater than or equal to the search_key.

If you use 1 or -1 as the search_type and the ranges are not properly ordered, the outcome can be unpredictable.

Examples

MATCH("Sunday", A1:A5, 0) returns 3, as Sunday is in the third row of the range.Example 1