Return the last match instead of the first when values repeat.
Copy this formula
=XLOOKUP(A2, B:B, C:C, , 0, -1)The sixth XLOOKUP argument is search mode; -1 searches from the bottom up, so it returns the last matching row. This is ideal for finding the most recent record for a key.
=XLOOKUP(A2, OrderID, Status, , 0, -1)→ShippedLatest status for a repeated order ID.
Use LOOKUP(2, 1/(B:B=A2), C:C), a classic trick that returns the last match.
Need a formula for your own data?
Describe what you want in plain language and let ExcelGPT write, explain, and verify the formula — free to start, no plugin.