Direct Answer: Find Exact Match Position With XMATCH
XMATCH returns the relative position (1st, 2nd, 3rd...) of a lookup value inside a single row or column, defaulting to an exact match:
=XMATCH(A2, $D$2:$D$100, 0)
Worked Example: Finding Position & Latest Entry
| Lookup Value | Search Column (D2:D5) |
Match Mode | XMATCH Output |
|---|---|---|---|
"INV-103" |
1: INV-101, 2: INV-102, 3: INV-103, 4: INV-104 | 0 (Exact) |
3 (3rd item in range) |
"INV-103" |
Search from last to first (-1 search mode) |
0, -1 |
Last matching row position |
How XMATCH Pairs With INDEX and Other Lookups
- Combine
INDEX+XMATCH: Use=INDEX($B$2:$B$100, XMATCH(A2, $D$2:$D$100, 0))to return a matching value from any column—similar to INDEX-MATCH. - Compare with XLOOKUP: Use
XLOOKUPwhen you want the actual cell value back directly, and useXMATCHwhen you specifically need the numeric position or index.
Error Tip: When no match exists,
XMATCH returns #N/A. Wrap in IFERROR if you want a custom message or zero.