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.
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
=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;
0exact,-1exact or next smaller,1exact or next larger,2wildcard - [search_mode] — optional;
1first to last,-1last to first
For most uses, exact match is the safest pattern:
=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:
=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:
=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
| MATCH | XMATCH | |
|---|---|---|
| Modern exact-match default | Less clear | Clearer |
| Reverse search | No | Yes |
| More flexible matching options | Limited | Better |
| Best for newer Excel workbooks | Okay | Better |
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
| Mistake | What happens | Fix |
|---|---|---|
| Omitting exact match when it matters | Approximate logic can surprise you | Use 0 for exact matching |
| Confusing position with returned value | Formula returns a number instead of the wanted data | Pair XMATCH with INDEX when you need the value |
| Searching the wrong range shape | Position is meaningless or wrong | Make 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.
Sources
Do this with AI
Turn the instructions into a finished spreadsheet.
Tell Griddy what you need in plain English, then inspect and keep editing the result in the browser, Excel, or 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 Tracker
Track tasks, owners, priorities, due dates, and blockers in one delivery board. Group work by stream, review progress, and keep next steps visible.
Open templateProject ManagementProject Tracker for Marketing Teams
Coordinate marketing workstreams, owners, status, priority, completion, and next milestones with a dashboard, log, and setup sheet.
Open templateProject ManagementProject Tracker for Client Work
Coordinate client commitments, milestones, owners, approvals, blockers, due dates, and completion across engagements.
Open templateProject ManagementProject Tracker for Agencies
Coordinate agency deliverables across client-safe workstreams, owners, approval gates, dependencies, dates, completion, and review signals.
Open templateProject ManagementGantt Chart
Use this free Gantt chart template to plan project phases, owners, milestones, dependencies, and weekly timelines in Excel, Google Sheets, or Griddy.
Open templateProject ManagementGantt Chart for Product Launches
Sequence product-launch tasks with owners, dependencies, start weeks, durations, completion, status, remaining days, and an 8-week timeline grid.
Open templateProject ManagementGantt Chart for Agencies
Sequence agency discovery, creative, production, client review, launch, and reporting work with dependencies and an eight-week timeline.
Open templateProject ManagementOKR Tracker
Track company and team OKRs in one quarterly scorecard. Keep objective scores, KR progress, and leadership notes visible without needing dedicated OKR software.
Open templateProject ManagementOKR Tracker for Startups
Track startup objectives for runway, growth, product, and hiring with owners, targets, current values, progress, confidence, and check-ins.
Open templateProject ManagementMarketing OKR Dashboard
Track marketing objectives, key results, owners, targets, progress, health, and leadership notes in one free two-sheet OKR dashboard.
Open template