Positions with XMATCH
The log is in date order and drivers appear more than once. Where in the log is each driver's latest delivery?
keyboard Typing formulas is easiest on a computer with a keyboard.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Driver | Drop-off | Driver | Latest delivery | |||
| 2 | Tariq | Hull | Tariq | ||||
| 3 | Nadia | Leeds | Nadia | ||||
| 4 | Daniel | Harrogate | Daniel | ||||
| 5 | Daniel | Selby | |||||
| 6 | Tariq | York | |||||
| 7 | Tariq | Ripon | |||||
| 8 | Quinn | Wakefield | |||||
| 9 | Daniel | Bradford | |||||
| 10 | Nadia | Hull | |||||
| 11 | Quinn | Wakefield | |||||
| 12 | Daniel | Ripon | |||||
| 13 | Quinn | Ripon | |||||
| 14 | |||||||
| 15 | |||||||
| 16 | |||||||
| 17 |
How XMATCH works
What does
XMATCHdo?It gives the position of a value in a list: 1 if it's first, 2 if it's second, and so on.
=XMATCH(lookup_value,lookup_array, [match_mode], [search_mode]) How is it different from
MATCH?XMATCHis the modernMATCH: it does an exact match by default (MATCHneeds a 0 for that), and it can search from the end.How do I find the last one?
Set search_mode, the fourth part, to -1:
=XMATCH(E2,$A$2:$A$13,0,-1)searches from the bottom up, so it finds the latest entry in a list kept in date order. The 0 before it is match_mode: exact match.Is the position the row number?
No. It's the position inside the range: with a range starting at
A2, position 1 is row 2. Use it withINDEXto fetch a value from that position.
Know someone fighting with a spreadsheet? Send them this page.