Function · Lookup

Excel MATCH function

The Excel MATCH function returns the position of a value in a list. Exact match needs a third argument of 0. An oat-milk example.

All current Excel versions. Also in Excel for the web and Google Sheets.

Syntax =MATCH(lookup_value, lookup_array, [match_type])

MATCH
=MATCH("Oat milk",A2:A5,0)

Arguments

NameRequiredWhat to pass
lookup_valueRequiredThe value to find.
lookup_arrayRequiredA single row or a single column to search.
match_typeOptional0 is an exact match. 1, the default, is the largest value less than or equal to the lookup, and the range must be sorted ascending. -1 is the smallest value greater than or equal, sorted descending.

Examples

Where oat milk sits in the price list

=MATCH("Oat milk",A2:A5,0)

Result 3

=MATCH("Oat milk",A2:A5,0)C2
Prices
ABC
1ItemPricePosition of oat milk
2Whole milk3.493
3Eggs4.29
4Oat milk4.79
5Bread3.19
A picture of the sheet. The 0 in MATCH asks for an exact match. Position 3 is the third item, oat milk.

MATCH returns a position, not the cell’s contents. Oat milk is the third item, so the result is 3. Feed that 3 to INDEX when you want the price. The position is counted inside the range, starting at 1. It is not the sheet’s row number. A2 is position 1 of A2:A5 even though it is row 2 of the sheet.

The third argument defaults to 1. That form expects the list to be sorted ascending and returns the closest item that is not greater than what you asked for. On a list of product names it will quietly return the wrong row. Pass 0 for an exact match.

XMATCH is the newer version, with the same ideas as XLOOKUP. Use MATCH when the file still has to open in Excel 2019 or earlier.