LOOKUP function
LOOKUP is an older lookup that always does an approximate match on sorted data and returns the result at the matching position. It is still used for the classic last-value-in-a-column trick.
Example
Read it as a sentence: find the largest value in J1:J5 that is no more than 25, then return the matching value from K1:K5, which gives b.
Syntax
LOOKUP(lookup_value, lookup_vector, [result_vector])
Arguments in [square brackets] are optional.
-
lookup_value(required) - Value to find.
-
lookup_vector(required) - One row or column to search; must be sorted ascending.
-
result_vector(optional) - A matching-size row or column to return from.
Returns: The result at the matching position, using approximate match.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=LOOKUP(25,{10,20,30},{"a","b","c"}) | b | Arrays |
=LOOKUP(25,{10,20,30;"a","b","c"}) | b | Array form, 2 rows |
=LOOKUP(25,Data!J1:J5,Data!K1:K5) | b | Vector approximate |
=LOOKUP(30,Data!J1:J5,Data!K1:K5) | c | Vector exact value |
=LOOKUP(99,Data!J1:J5) | 50 | Above last, one vector |
=LOOKUP("Cb",Items!B2:B7,Items!D2:D7) | 20 | Text approximate |
=LOOKUP(5,Data!J1:J5,Data!K1:K5) | #N/A | Below first |
=LOOKUP("12",Data!J1:J5,Data!K1:K5) | #N/A | Text lookup in numbers |
The Data sheet these formulas read
A cell that starts with = holds that formula.
The Items sheet these formulas read
Watch out for
- Data must be sorted ascending or results are unreliable.
- No exact-match option; use XLOOKUP for that.
- Has a rarely used array form.
Where it works
- Excel
- LOOKUP is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Lookup and reference functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .