XMATCH Function in Excel: MATCH With Better Defaults

XMATCH Function in Excel: MATCH With Better Defaults featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 5 October 2026

LookupLevel: IntermediateAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. XMATCH in practice
  6. Where you will use it
  7. Worked example
  8. Mistakes people make
  9. Related functions
  10. Continue learning

XMATCH returns the position of an item, defaulting to exact match, and can search from the end or use wildcards.

Advertisement

Syntax

=XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])
Argument What it means
match_mode 0 exact (default), βˆ’1/1 next smaller/larger, 2 wildcard.
search_mode 1 first-to-last, βˆ’1 last-to-first.

Examples

Example 1

=XMATCH("Mar", B1:M1)

Column position of March.

Example 2

=XMATCH(F2, A:A, 0, -1)

Position of the last occurrence.

XMATCH in practice

Where you will use it

  • Position of an item
  • Last occurrence
  • Wildcard positions

Worked example

FindFormulaResult
May=IFERROR(XMATCH(A2,{"Apr","May","Jun"}),"not found")2
Jun=IFERROR(XMATCH(A3,{"Apr","May","Jun"}),"not found")3
Dec=IFERROR(XMATCH(A4,{"Apr","May","Jun"}),"not found")not found

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Default exact matchUnlike MATCH, XMATCH is exact by default
Reverse searchsearch_mode -1

MATCH Β· XLOOKUP Β· INDEX

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Lookup & reference17 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 35 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *