XMATCH Function in Excel & Google Sheets: Exact Position & Reverse Search

Find the exact position of a value inside a row or column, search from bottom to top for the latest entry, and pair with INDEX.

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

Error Tip: When no match exists, XMATCH returns #N/A. Wrap in IFERROR if you want a custom message or zero.
Editorial & Accuracy Note: Tested across Microsoft Excel and Google Sheets with worked sample inputs and outputs. Part of the Know Unlimited Excel & Google Sheets Hub.