உள்ளடக்கத்திற்கு செல்க
Lookup & ReferenceAdvanced LevelAdvanced Excel (Dynamic Arrays & Automation)

How to Use XMATCH in Excel

The modern replacement for MATCH with exact-match default, reverse search and wildcard support built in.

Direct Answer (Quick Summary)

What is XMATCH in Microsoft Excel?

XMATCH returns the position of a value, like MATCH, but defaults to exact matching and adds a search_mode that can scan from the bottom up. That makes finding the last transaction for a customer a one-cell formula instead of an array trick. It also pairs with XLOOKUP for nested lookups.

Pro Tip: search_mode -1 is the killer feature. =XMATCH(A2,IDs,,,-1) returns the last matching position, which previously needed LOOKUP(2,1/(...)) array hacks.

Formula Syntax

=XMATCH(lookup_value, lookup_array, match_mode, search_mode)

Arguments Breakdown

ArgumentRequirementPurpose & Details
lookup_valueRequiredThe value whose position you want.
lookup_arrayRequiredThe one-dimensional range to search.
match_modeOptional0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard match.
search_modeOptional1 first-to-last (default), -1 last-to-first, 2 binary ascending, -2 binary descending.

When to Use XMATCH (Real-World Business Scenarios)

  • 1

    Finding the position of the most recent entry with search_mode -1, which searches last-to-first.

  • 2

    Building two-way lookups where XMATCH supplies both the row and the column index.

  • 3

    Replacing MATCH formulas that broke because someone forgot the trailing 0 for exact match.

Step-by-Step Practical Business Example

Suppose you have the following dataset in Excel cells A1:D4:

OrderCustomerAmount
ORD-101Rahul1200
ORD-102Pooja850
ORD-103Rahul3400
Applied Formula:Result: 3
=XMATCH("Rahul",B2:B4,0,-1)

How it works: Searches the customer column from the bottom up and returns 3, the position of Rahul's most recent order, instead of 1 which a normal top-down search would give.

Common Errors & How to Fix Them

#N/A

Why it happens: The value does not exist in the lookup array.

Fix: Confirm spelling and whitespace, or wrap the call in IFNA to return a friendly fallback.

#VALUE!

Why it happens: lookup_array is two-dimensional, which XMATCH does not accept.

Fix: Pass a single row or a single column. For a grid, combine two XMATCH calls with INDEX.

Interactive Formula Lab

Try XMATCH Live in Your Browser

No need to launch desktop Excel. Practice formulas with real-time feedback in our HyperFormula sandbox.

Open Practice Lab

Frequently Asked Questions (XMATCH)

What does the XMATCH formula do in Excel?

XMATCH returns the position of a value, like MATCH, but defaults to exact matching and adds a search_mode that can scan from the bottom up. That makes finding the last transaction for a customer a one-cell formula instead of an array trick. It also pairs with XLOOKUP for nested lookups.

What is the syntax for XMATCH?
=XMATCH(lookup_value, lookup_array, match_mode, search_mode)
What are common mistakes when using XMATCH?

#N/A: The value does not exist in the lookup array. (Confirm spelling and whitespace, or wrap the call in IFNA to return a friendly fallback.) #VALUE!: lookup_array is two-dimensional, which XMATCH does not accept. (Pass a single row or a single column. For a grid, combine two XMATCH calls with INDEX.)

Keep building your formula toolkit with these lookup & reference functions.

Browse all 41 Excel formulas
Ready to Master Microsoft Excel?

Master XMATCH in Advanced Excel

Learn XMATCH along with our formula library, practice files, and verifiable certificates in our complete curriculum.

Strictly necessary