1. Home
  2. Functions
  3. Lookup and reference
  4. XMATCH

XMATCH function

Returns the position of an item in a row or column, with exact, approximate, wildcard and binary search options.

Syntax

=XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])

Arguments

ArgumentRequiredDescription
lookup_valueRequiredThe value to look for
lookup_arrayRequiredThe row or column to search
match_modeOptional0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard
search_modeOptional1 first to last (default), -1 last to first, 2 binary search ascending, -2 binary search descending

How to use XMATCH

XMATCH takes 2 required arguments and 2 optional arguments. Type =XMATCH( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=XMATCH("c", {"a","b","c"})Result 3
=XMATCH(35, {10,20,30,40}, 1)Result 4
=XMATCH("b*", {"apple","banana","berry"}, 2, -1)Result 3

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.