Skip to content
getgriddy.ai/blog/how-to-use-xmatch-in-excel
Excel

How to Use XMATCH in Excel

XMATCH returns the position of a value in a range and improves on MATCH with cleaner exact matching, reverse search, and better flexibility. Here's how to use it.

·5 min read

Reviewed by Griddy

Updated for current Excel and Google Sheets workflows, with examples chosen to map back to real spreadsheet tasks rather than abstract formula syntax.

XMATCH returns the position of a value inside a range. It is the modern replacement for MATCH and is especially useful when you want cleaner exact matches, reverse search, or a lookup pattern that pairs well with INDEX.

That makes it useful in trackers, dashboards, and summary sheets where the formula needs to find a column or row position before returning the actual value.

The syntax

fx
=XMATCH(lookup_value, lookup_array, [match_mode], [search_mode])
  • lookup_value — the value you want to find
  • lookup_array — the range Excel should search
  • [match_mode] — optional; 0 exact, -1 exact or next smaller, 1 exact or next larger, 2 wildcard
  • [search_mode] — optional; 1 first to last, -1 last to first

For most uses, exact match is the safest pattern:

fx
=XMATCH("Blocked", B1:F1, 0)

Basic example with INDEX

If row 1 contains project summary headers and row 2 contains the values, you can return the value under a specific header like this:

fx
=INDEX(B2:F2, XMATCH("Owner", B1:F1, 0))

XMATCH finds the position of Owner in the header row, and INDEX returns the value from that same position in row 2.

That is a flexible pattern in project summary blocks where the column order may shift over time.

Search from last to first

One of XMATCH's useful upgrades is reverse search.

If column C contains task status and you want the position of the last Done entry:

fx
=XMATCH("Done", C2:C100, 0, -1)

This can be useful when you want the most recent matching milestone instead of the first one.

XMATCH vs MATCH

MATCHXMATCH
Modern exact-match defaultLess clearClearer
Reverse searchNoYes
More flexible matching optionsLimitedBetter
Best for newer Excel workbooksOkayBetter

MATCH still works. XMATCH is usually easier to reason about in newer Excel environments.

When XMATCH is better than XLOOKUP

Use XLOOKUP when you want the returned value directly.

Use XMATCH when you specifically need the position first, often because:

  • you are pairing it with INDEX
  • you are locating a dynamic column
  • you need the last matching position

That is why XMATCH fits better in some dashboard and tracker formulas than XLOOKUP does.

Common XMATCH mistakes

MistakeWhat happensFix
Omitting exact match when it mattersApproximate logic can surprise youUse 0 for exact matching
Confusing position with returned valueFormula returns a number instead of the wanted dataPair XMATCH with INDEX when you need the value
Searching the wrong range shapePosition is meaningless or wrongMake sure the lookup array is the exact row or column you intend
Using XMATCH in older Excel versions#NAME?Use a modern Excel version or fall back to MATCH

NOTE

If the workbook must work in older Excel versions, MATCH is still the safer compatibility choice.

Where XMATCH fits best

XMATCH is strongest in workbooks where the sheet structure changes over time but the formula still needs to find the right field reliably.

That is common in:

The Griddy way

XMATCH is not hard once you understand it, but remembering when you want a position versus a returned value is where people usually get tripped up.

"Find the position of the Blocked column in this tracker header, then return the matching value from the summary row"

Griddy can structure the INDEX + XMATCH pattern around your real headers without making you debug the lookup logic manually.

Skip the manual work

Describe it. Griddy does it.

Instead of writing this formula yourself, just tell Griddy what you need in plain English. Works in Excel and Google Sheets.

Use this on real templates

Use position-based lookups in dynamic planning sheets

XMATCH is useful when trackers and summary views need to locate headers or the last matching item without relying on fragile hard-coded positions.

Project Management
Free Project Tracker Spreadsheet Template preview
Project Management

Project Tracker

Track tasks, owners, priorities, due dates, and blockers in one delivery board. Group work by stream, review progress, and keep next steps visible.

Free templateOpen →
Free Project Tracker Template for Marketing Teams preview
Project Management

Project Tracker for Marketing Teams

Track campaign work, owners, deadlines, approvals, and blockers in one free marketing project tracker spreadsheet for Excel and Google Sheets.

Free templateOpen →
Free Project Tracker Template for Client Work preview
Project Management

Project Tracker for Client Work

Track client deliverables, owners, due dates, approvals, and blockers in one free project tracker spreadsheet built for service teams.

Free templateOpen →
Free Gantt Chart Template — Excel & Google Sheets preview
Project Management

Gantt Chart

Plan project phases, owners, and milestones on a 12-week timeline. Colour-coded bars make schedules easy to scan in Excel, Google Sheets, or Griddy.

Free templateOpen →
Free Gantt Chart Template for Product Launches preview
Project Management

Gantt Chart for Product Launches

Plan launch milestones, owners, dependencies, and timing in one free Gantt chart spreadsheet built for product launches and release work.

Free templateOpen →
Free Gantt Chart Template for Agencies preview
Project Management

Gantt Chart for Agencies

Plan agency timelines, client phases, approvals, and launch milestones in one free Gantt chart spreadsheet for service delivery teams.

Free templateOpen →
Free OKR Tracker Spreadsheet Template preview
Project Management

OKR Tracker

Track company and team OKRs in one quarterly scorecard. Keep objective scores, KR progress, and leadership notes visible without needing dedicated OKR software.

Free templateOpen →
Free OKR Tracker Template for Startups preview
Project Management

OKR Tracker for Startups

Track startup objectives, key results, owners, progress, and confidence in one free OKR spreadsheet built for quarterly planning and review.

Free templateOpen →