FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

XMATCH in Google Sheets

XMATCH with worked examples you can test in the live grid. The argument details are in the Excel guide.

In Google Sheets

The arguments and common errors are covered in the XMATCH Excel guide; check the function help in Google Sheets for its own argument list.

Worked examples in Google Sheets

First match

A
1Region
2East
3West
4East
5North
6West

Formula: C2: =XMATCH("West",A2:A6)

Result: 2

The first West is the second item in the range.

Last match

A
1Region
2East
3West
4East
5North
6West

Formula: C2: =XMATCH("West",A2:A6,0,-1)

Result: 5

Searching from the end finds the West in position 5.

Next larger value

A
1Limit
250
3100
4200
5150

Formula: C2: =XMATCH(120,A2:A5,1)

Result: 4

The smallest value that is 120 or more is 150, which sits in position 4.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =XMATCH(103,A2:A6)

Example spreadsheet for XMATCH
ABCDEF
1IDItemPriceStockResult
2101Pen2.51203
3102Notebook480
4103Lamp2515
5104Mug7.540
6105Backpack3912
Result in F2: 3

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.