Lookup & reference function

LOOKUP function

Looks up a value in a one-row or one-column range and returns the value in the same position of a second range. Expects sorted data.

Available in All versions of Excel, including Microsoft 365, Excel for the web and Excel for Mac

In every Excel versionWorks in Google Sheets

Syntax

LOOKUP(lookup_value, lookup_vector, [result_vector])
ArgumentWhat it means
lookup_valueRequiredThe value to search for.
lookup_vectorRequiredA single row or column to search. It should be sorted in ascending order.
result_vectorOptionalA single row or column of the same size to return from. If omitted, LOOKUP returns from lookup_vector itself.

Returns: The value from result_vector at the position of the largest item in lookup_vector that is less than or equal to lookup_value.

How LOOKUP works

LOOKUP is one of Excel's oldest functions. It always performs an approximate match: it finds the largest value in the lookup range that is less than or equal to what you are searching for, then returns the matching position from the result range. When the lookup range is sorted and contains your exact value, that is an exact lookup; when it does not, you get the closest lower band.

Because it assumes sorted data and cannot be told to require an exact match, LOOKUP is risky for codes and names - it will quietly return a neighbouring row instead of an error. It still earns its place in two situations: quick band lookups with array constants (grades, discounts) and the famous trick that finds the last non-empty value in a column, which works because LOOKUP ignores error values while it searches.

There is also an older array form (LOOKUP(value, array)) that searches the first row or column of a rectangle; Microsoft keeps it for compatibility, but XLOOKUP, VLOOKUP or HLOOKUP are clearer for that job.

Examples

1Grade with an array constant

C2fx=LOOKUP(B2, {0,50,65,80,90}, {"F","D","C","B","A"})
ABC
1StudentScoreGrade
2Lena73C
3Omar91

Result: C

73 falls between the 65 and 80 boundaries, so LOOKUP takes the band for 65 and returns C. Copied down to C3, Omar's 91 returns A.

2Last value entered in a column

D2fx=LOOKUP(2, 1/(B2:B6<>""), B2:B6)
ABCD
1DayClosing stock
2Mon140125
3Tue132
4Wed118
5Thu125
6Fri

Result: 125

1/(B2:B6<>"") makes an array of 1s for filled cells and #DIV/0! errors for empty ones. LOOKUP searches for 2, never finds it, ignores the errors and settles on the last 1 - Thursday's 125. The figure updates as soon as Friday is typed in.

3Sorted ID list

E2fx=LOOKUP(1003, A2:A5, C2:C5)
ABCDE
1Emp IDNameDepartment
21001Maria LopezSalesIT
31002Tom BeckerFinance
41003Aisha KhanIT
51004Luca RossiSales

Result: IT

The IDs in A2:A5 are in ascending order and 1003 exists, so LOOKUP returns the department in the same position. On unsorted data the same formula could return the wrong person.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/Alookup_value is smaller than the smallest value in lookup_vector.Add a lower bound such as 0 to the start of the lookup range.
Wrong result, no errorThe lookup range is not sorted ascending, or the exact value is missing and LOOKUP returned the next lower item.Sort the data, or use XLOOKUP / VLOOKUP with an exact match.

Tips

  • LOOKUP has no exact-match option. Use it for bands, not for codes or names.
  • The LOOKUP(2, 1/(...), ...) pattern also works with conditions, e.g. =LOOKUP(2, 1/(A2:A100="Ana"), C2:C100) returns Ana's most recent entry.
  • In Microsoft 365, =XLOOKUP(TRUE, B2:B100<>"", B2:B100, , , -1) is a more readable way to get the last value.

Google Sheets

LOOKUP also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

LOOKUP in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechVYHLEDAT
DanishSLÅ.OP
DutchZOEKEN
FinnishHAKU
FrenchRECHERCHE
GermanVERWEIS
HungarianKERES
ItalianCERCA
Norwegian (Bokmål)SLÅ.OPP
PolishWYSZUKAJ
Portuguese (Brazil)PROC
Portuguese (Portugal)PROC
RussianПРОСМОТР
SpanishBUSCAR
SwedishLETAUPP
TurkishARA

Recipes that use LOOKUP