The LOOKUP function

Looks up a value in one row or column and returns the value in the same position from another. It always does an approximate match, so the lookup range must be sorted from smallest to largest.

Syntax

LOOKUP(lookup_value, lookup_vector, [result_vector])
lookup_value
The value to look for. LOOKUP finds the largest value that is less than or equal to it.
lookup_vector
The row or column to search, sorted A to Z or smallest to largest.
result_vector (optional)
The row or column to return from, the same size as lookup_vector. Left out, LOOKUP returns from lookup_vector.

Examples

D1=LOOKUP(85,A2:A6,B2:B6)
ABCD
1Lowest scoreGradeB
20F
360D
470C
580B
690A

In plain words: Find 85 in the lowest scores in A2:A6, or the closest one below it, and return the grade next to it in B2:B6.

D1=LOOKUP(60,A2:A6,B2:B6)
ABCD
1Lowest scoreGradeD
20F
360D
470C
580B
690A
D1=LOOKUP(2,1/(B2:B6<>""),B2:B6)
ABCD
1DaySales140
2Mon120
3Tue95
4Wed140
5Thu
6Fri

Questions

Why does LOOKUP return the wrong value?

The lookup range is not sorted from smallest to largest. LOOKUP always looks for the closest value below, so on unsorted data it stops in the wrong place. For an exact match, use XLOOKUP or VLOOKUP with FALSE.

How do I get the last value in a column?

=LOOKUP(2,1/(B2:B100<>""),B2:B100) returns the last filled cell. Filled cells become 1 and empty ones an error, and LOOKUP looking for 2 lands on the last 1.

Related functions