Positions with XMATCH

1 / 5

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.

A1
ABCDEFG
1DriverDrop-offDriverLatest delivery
2TariqHullTariq
3NadiaLeedsNadia
4DanielHarrogateDaniel
5DanielSelby
6TariqYork
7TariqRipon
8QuinnWakefield
9DanielBradford
10NadiaHull
11QuinnWakefield
12DanielRipon
13QuinnRipon
14
15
16
17
log
drivers
position
Type to enter a value or a formula starting with =. F2 edits, F4 adds $ to a reference.
Study notes

How XMATCH works

  • What does XMATCH do?

    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?

    XMATCH is the modern MATCH: it does an exact match by default (MATCH needs 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 with INDEX to fetch a value from that position.

Know someone fighting with a spreadsheet? Send them this page.