ShareYourGroupShareYourGroupExcel Formulas

Lookup functions

XMATCH function in Excel

XMATCH returns the position of a value in a range, with exact match as the default and a choice of search direction.

XMATCH is the newer form of MATCH, introduced together with XLOOKUP. It returns a position in the same way, and fixes the things that made MATCH risky. It is in Excel 2021 and Microsoft 365, and not in earlier versions.

Syntax

=XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])
ArgumentWhat it is
lookup_valueThe value to look for.
lookup_arrayA single row or column to search.
match_mode0 exact match (the default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard match.
search_mode1 first to last (the default), -1 last to first.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Twelve sales made by four salespeople in three regions.
ABCDEF
1DateSalespersonRegionProductUnitsAmount
205-Jan-2026AshaNorthNotebook201200
312-Jan-2026RaviSouthPen50500
420-Jan-2026MeenaNorthBag43000
502-Feb-2026AshaEastPen30300
614-Feb-2026KabirSouthNotebook15900
728-Feb-2026RaviNorthBag21500
803-Mar-2026MeenaEastNotebook402400
915-Mar-2026AshaNorthBag32250
1022-Mar-2026KabirSouthPen60600
1101-Apr-2026RaviEastNotebook251500
1218-Apr-2026MeenaNorthPen80800
1306-May-2026AshaSouthBag53750

What is different from MATCH

Match modes

match_modeMeaning
0exact match
-1exact match, or the next smaller item
1exact match, or the next larger item
2wildcard match, with * and ?

Typical uses

The latest entry for a person or product. Pair it with INDEX, as in the third example. Before XMATCH this needed an awkward array formula.

The nearest value in an unsorted list. =XMATCH(target, range, -1) finds the closest value at or below a target wherever it sits.

Position in a ranking. If a column of scores is sorted from highest to lowest, the XMATCH of a score is its place.

XMATCH or XLOOKUP?

If you want the value itself, XLOOKUP does it in one step. Use XMATCH when you need the position: to feed INDEX with a row and a column, to choose a column by its heading, or to test whether something is in a list with ISNUMBER(XMATCH(...)).

Common mistakes

In Google Sheets

Google Sheets has XMATCH too, with the same arguments.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.