Example

To perform an ordinary exact match, only the first two arguments are required.

Typically, the XMATCH function is used together with the INDEX function to retrieve a valueat a specific location.

XMATCH vs.

XMATCH exact match example

MATCH

XMATCH is an upgraded replacement for the MATCH function.

Like the MATCH function, XMATCH performs a lookup and returns a numeric position.

Let me know if you notice other differences and I will include them on this page.

XMATCH exact match example

Note thatmatch_modeis an optional argument.

If you do not provide a value, XMATCH will default to an exact match.

TheXLOOKUP functionwas also updated to support regex.

XMATCH exact match example

For more about regex in Excel, seeRegular Expressions in Excel.

Search mode

The fourth argument for XMATCH issearch_mode.

If data is not sorted properly, a binary search can return invalid results that look perfectly normal.

XMATCH exact match example

XMATCH with wildcard

Whenmatch_modeis set to 2, XMATCH can perform a match usingwildcards.

Notice that XMATCH isnotcase-sensitive.

XMATCH with Regex

XMATCH can also match with “regex” (short for Regular Expressions).

XMATCH exact match example

This problem is trickier than it looks.

Each product code begins with 3 uppercase letters and ends with 2 or 3 uppercase letters.

In the middle of the product code is a number between 2 and 4 digits.

XMATCH match mode examples

A wildcard match won’t work because a number like 56 can appear insideother product codes.

However, we can easily solve this problem with a “regex match”.

To enable a regex match in XMATCH, provide 3 formatch_mode.

XMATCH with wildcard example

Then supply a valid regex pattern as thelookup_value.

Regex is a powerful and somewhat complex language.

For a detailed explanation of the regex used in this example, seeXLOOKUP with regex.

XMATCH with regex example

XLOOKUP and XMATCH support regex in the same way.

Although the functions are different, the regex pattern is exactly the same.

Regex matching was added to XMATCH in December 2024, so this feature is only available in Excel 365.

XMATCH with multiple criteria

For an introduction to regex in Excel, seeRegular Expressions in Excel.

For more details,see this page.

Case-sensitive match

The MATCH function is not case-sensitive.

Excel formula: List upcoming birthdays

This formula is explained in anINDEX and MATCH example here.

The example uses theMATCH function, but XMATCH can be substituted with the same result.

XMATCH has a binary search option that runsvery quickly.

Excel formula: Nearest location with XMATCH

To enable binary search mode, data must be sorted in ascending or descending order.

If values are sorted inascending order, use the value 2 forsearch_mode.

If values are sorted indescending order, use the value -2.

Excel formula: Get last match

XLOOKUP supports approximate and exact matching, wildcards (* ?)

MATCH supports approximate and exact matching, andwildcards(* ?)

it’s possible for you to use INDEX to retrieve individual values, or entire rows and columns.

Excel formula: INDEX and MATCH two-column lookup

LOOKUP’s default behavior makes it useful for solving certain problems in Excel.

The output from FILTER is dynamic.

If source data or criteria change, FILTER will return a new set of results.

Excel formula: Cell contains specific words

This makes FILTER a flexible way to isolate and inspect data without altering the…

Excel formula: XMATCH reverse search

Excel formula: Extract common values from two lists

Excel formula: Extract common values from text strings

Excel formula: INDEX and MATCH with variable columns

Excel formula: XLOOKUP binary search

Excel formula: XMATCH with multiple criteria

Excel formula: Income tax bracket calculation

Excel XLOOKUP function

Excel MATCH function

Excel VLOOKUP function

Excel HLOOKUP function

Excel INDEX function

Excel LOOKUP function

Excel FILTER function

XMATCH match mode examples

XMATCH with regex example