Explanation

The LOOKUP function assumes data is sorted, and always does an approximate match.

Notice the array contains only two unique values: the divide by zero error (#DIV/0!)

and the number 1.

Excel formula: Get date associated with last entry

LOOKUP searches the array for the value 2, ignoring the error values.

Not finding 2, it falls back to the last 1, at position 7 in the lookup vector.

LOOKUP’s default behavior makes it useful for solving certain problems in Excel.

Excel formula: Get value of last non-empty cell

Excel formula: Get information about max value

Excel formula: XLOOKUP latest by date

Excel LOOKUP function