Menu

MATCH Function in Excel: Find the Position of a Value

=MATCH(E2,A2:A6,0) returns the position of E2 in A2:A6: 4 if it is the fourth item. Match types 0, 1 and -1, wildcards, case-sensitive matching and checking whether a value is in a list.

Every sheet on this page is live: change a number or a formula and it recalculates.

=MATCH(E2,A2:A6,0) returns the position of the value in E2 within A2:A6: 1 for the first cell, 2 for the second, and so on. The 0 asks for an exact match. MATCH returns a number, not the value itself, which is why it is usually paired with INDEX.

Position of a product in the list
F2
ABCDEF
1ProductCategoryPriceLook forPosition
2AppleFruit$1.20Bread4
3PearFruit$1.50
4CarrotVegetable$0.80
5BreadBakery$2.40
6MilkDairy$1.10
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Bread is the fourth cell of A2:A6, so F2 shows 4. The count starts at the first cell of the range, not at row 1 of the sheet: change the range to A1:A6 and the answer becomes 5. Type Kiwi in E2 and MATCH returns #N/A.

MATCH syntax and match types

=MATCH(lookup_value, lookup_array, [match_type])
match_typeFindsThe list must be
0The first value exactly equal to lookup_value. Wildcards allowed for text.in any order
1 or omittedThe largest value less than or equal to lookup_value.sorted ascending
-1The smallest value greater than or equal to lookup_value.sorted descending

The default is 1, not 0. A MATCH without its third argument on an unsorted list of names does not complain: it returns a position that may belong to another row. Write the 0 every time you look up text, codes or IDs.

Approximate match: which band a value falls in

With match type 1, MATCH answers "which band": the position of the last threshold the value has reached. Here a score of 75 has passed 0, 60 and 70, so it is in band 3, grade C.

Band of a score
E2
ABCDEF
1Min scoreGradeScoreBandGrade
20F753C
360D591F
470C905A
580B1005A
690A
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

59 is still below 60, so it is band 1 (F). 90 is an exact match for the last threshold, and 100 is above it, so both land in band 5 (A). The thresholds have to stay in ascending order: that is what lets MATCH stop at the right place.

Match type -1 is the mirror image for a list sorted from largest to smallest. It returns the position of the smallest value that is still greater than or equal to the lookup value: with sizes {50;25;12;5} in a column, =MATCH(18,D2:D5,-1) returns 2, the 25 size, the smallest that holds 18.

Wildcards and case

MATCH ignores case, and with match type 0 it accepts the wildcards * (any characters) and ? (exactly one character). For a case-sensitive match, compare the list with EXACT and look for the first TRUE.

Three ways to match text
E1
ABCDE
1ProductCategoryPriceStarts with "C"3
2AppleFruit$1.20Lower case "milk"5
3PearFruit$1.50Exactly "milk"#N/A
4CarrotVegetable$0.80
5BreadBakery$2.40
6MilkDairy$1.10
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

"C*" matches Carrot, position 3. "milk" finds Milk at position 5, because case is ignored. The EXACT version compares each name with "milk" case by case, finds no TRUE and returns #N/A. Change A6 to milk and it returns 5. In Excel 2019 and older, confirm the EXACT formula with Ctrl+Shift+Enter (Cmd+Shift+Enter on a Mac); in Excel 2021 and Microsoft 365 Enter is enough. A tilde makes a wildcard literal: "~*" looks for an actual asterisk.

Check if a value is in a list

MATCH returns a number when it finds the value and #N/A when it does not. ISNUMBER turns that into TRUE or FALSE, which is a quick "is this in the list" test.

Which ordered items are in stock?
B2
ABCD
1OrderedIn stock?In stock
2PearYesApple
3KiwiNoPear
4MilkYesBread
5PlumNoMilk
6BreadYes
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Pear, Milk and Bread are in D2:D5, so they show Yes. Kiwi and Plum show No. COUNTIF($D$2:$D$5,A2)>0 gives the same answer; MATCH stops at the first hit, COUNTIF counts every one.

MATCH, XMATCH and INDEX

MATCH is half of the classic lookup =INDEX(C2:C6,MATCH(E2,A2:A6,0)), explained on the INDEX and MATCH page. Excel 2021 and Microsoft 365 add XMATCH, which defaults to an exact match, can search from the last item up, and handles "next larger" without a descending sort. MATCH still works everywhere, including in files that must open in Excel 2019.

Practice: position of an employee

Team list
F2
ABCDEF
1NameTeamStart yearNamePosition
2AnaSales2019Dev
3BenSupport2021
4CaraSales2018
5DevFinance2022
6EliSupport2020
7FayFinance2023
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: In F2, return the position of the name in E2 within the list in column A.

Frequently Asked Questions

What does MATCH return in Excel?

A position, not a value: =MATCH("Bread",A2:A6,0) returns 4 when Bread is the fourth cell of A2:A6. Pair it with INDEX to get the value at that position from another column.

What is the difference between match type 0, 1 and -1?

0 finds an exact match in any order. 1 (the default) finds the largest value less than or equal to the lookup value and needs the list sorted ascending. -1 finds the smallest value greater than or equal to it and needs the list sorted descending.

Is MATCH case-sensitive?

No. =MATCH("milk",A2:A6,0) finds Milk. For a case-sensitive match use =MATCH(TRUE,EXACT(A2:A6,"milk"),0), which needs Ctrl+Shift+Enter (Cmd+Shift+Enter on a Mac) in Excel 2019 and older.

How do I check if a value exists in a list with MATCH?

MATCH returns #N/A when the value is missing, so test whether it returned a number: =ISNUMBER(MATCH(A2,$D$2:$D$5,0)) gives TRUE or FALSE. Wrap it in IF for your own text.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED