Skip to content

LOOKUP

Finds the closest value at or below your lookup value in a sorted row or column and returns the item from the same position of another. It is the oldest lookup function.

Syntax

=LOOKUP(, , )

Lookup and reference

Every version of Excel, including Microsoft 365, Excel 2024, 2021, 2019, 2016 and earlier, Excel for the web and the mobile apps.

Try it

Edit the formula in B9 or change the inputs. The sheet recalculates as you type.

B9
A
B
C
1
Years from
Leave days
2
0
20
3
2
22
4
5
25
5
10
28
6
20
30
7
8
Years of service
Leave days
9
7
25

B9 =LOOKUP(A9,A2:A6,B2:B6) returns 25

How LOOKUP works

LOOKUP finds the largest value in a sorted list that is less than or equal to your lookup value, then returns the item in the same position from a second list. It is the oldest of Excel's lookup functions, and today it is mostly used for banded lookups and for a few well-known tricks.

The two forms

Vector form: LOOKUP(lookup_value, lookup_vector, result_vector). You give one sorted row or column to search and a matching row or column to return from. The two can be in different places, and the result can sit to the left of the search column.

Array form: LOOKUP(lookup_value, array). You give one table. LOOKUP searches its first column (or its first row, if the table is wider than it is tall) and returns the item from the last column (or last row). The array form exists for compatibility with other spreadsheet programs, and Microsoft recommends VLOOKUP or HLOOKUP instead. Use the vector form.

What LOOKUP can't do

LOOKUP has no exact-match option. It always runs an approximate match, so:

  • The lookup vector must be sorted ascending. On unsorted data LOOKUP can return a wrong answer with no warning.
  • If the lookup value is smaller than the first item, the result is #N/A.
  • If the value isn't in the list, LOOKUP does not say so. It returns the item for the closest smaller value, which can look like a valid answer. For IDs and names this is dangerous.

That makes LOOKUP a poor fit for exact lookups. Use XLOOKUP, or INDEX with MATCH and 0, or VLOOKUP with FALSE. For banded lookups, the vector form is fine, and it is a little shorter than the alternatives: =LOOKUP(A9, A2:A6, B2:B6).

Two well-known tricks

  • Last number in a column: =LOOKUP(9.99E+307, A2:A100). The huge lookup value is larger than any number you will enter, so LOOKUP lands on the last number in the range. Blanks and text are skipped.
  • Last match: =LOOKUP(2, 1/(B2:B100=E2), C2:C100). Dividing 1 by the test gives 1 where the test is TRUE and #DIV/0! elsewhere. LOOKUP ignores errors, and 2 is larger than anything it finds, so it returns the last row where the test is TRUE. In Microsoft 365, XLOOKUP with search_mode -1 does the same thing more clearly.

When to use it

LOOKUP is worth knowing because you will meet it in older workbooks. For new work, prefer XLOOKUP, which can match exactly, handle unsorted data and return a message when nothing matches. Keep LOOKUP for a quick banded lookup or the last-entry tricks when the file has to open in older versions of Excel.

Arguments

lookup_value
What to look for, such as A9. Point at a cell rather than typing the value.
lookup_vector
A single row or column to search, such as A2:A6. It must be sorted ascending, or LOOKUP can return a wrong result without an error. In the array form this argument is a table, and LOOKUP searches its first column (or first row, if the table is wider than it is tall).
result_vectoroptional
The row or column to return from, the same size as lookup_vector. If you leave it out (the array form), LOOKUP returns the item from the last column or row of the table.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Vector form: leave days by years of service

B9 =LOOKUP(A9,A2:A6,B2:B6)

Result: 25

7 isn't in the list, so LOOKUP takes the largest value not above it, 5, and returns the matching leave days from B2:B6. The first column must be sorted ascending.

B9
A
B
C
1
Years from
Leave days
2
0
20
3
2
22
4
5
25
5
10
28
6
20
30
7
8
Years of service
Leave days
9
7
25

B9 =LOOKUP(A9,A2:A6,B2:B6) returns 25

Example 2

Array form: search the first column, return the last

B9 =LOOKUP(A9,A2:B6)

Result: A

With a two-column table, LOOKUP searches column A and returns from the last column, B. 91 is at or above 85, so the grade is A.

B9
A
B
C
1
Score from
Grade
2
0
F
3
50
D
4
60
C
5
70
B
6
85
A
7
8
Score
Grade
9
91
A

B9 =LOOKUP(A9,A2:B6) returns A

Example 3

The last number in a column

C2 =LOOKUP(9.99E+307,A2:A9)

Result: 1344

The lookup value is larger than any reading, so LOOKUP returns the last number in A2:A9. The empty cells below are skipped, so new readings are picked up as you type them.

C2
A
B
C
D
1
Meter reading
Latest reading
2
1204
1344
3
1236
4
1271
5
1309
6
1344
7
8
9

C2 =LOOKUP(9.99E+307,A2:A9) returns 1344

Example 4

The last match for a text value

F2 =LOOKUP(2,1/(B2:B7=E2),C2:C7)

Result: 140

1/(B2:B7=E2) is 1 where the item is Gloves and #DIV/0! elsewhere. LOOKUP ignores the errors and, because 2 is larger than 1, lands on the last 1: the Wk 46 count.

F2
A
B
C
D
E
F
1
Week
Item
Count
Item
Latest count
2
Wk 44
Pallet wrap
38
Gloves
140
3
Wk 44
Gloves
120
4
Wk 45
Pallet wrap
31
5
Wk 45
Gloves
96
6
Wk 46
Pallet wrap
24
7
Wk 46
Gloves
140
8

F2 =LOOKUP(2,1/(B2:B7=E2),C2:C7) returns 140

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In B9, return the leave days for the years of service in A9, using LOOKUP on the table in A1:B6.

Answer in B9.

B9
A
B
C
D
E
F
1
Years from
Leave days
Meter reading
Latest reading
2
0
20
1204
3
2
22
1236
4
5
25
1271
5
10
28
1309
6
20
30
1344
7
8
Years of service
9
12
10
11

Common mistakes

  • The lookup vector must be sorted ascending. LOOKUP never warns you: on unsorted data it returns whatever its search lands on.
  • There is no exact match. A value that isn't in the list returns the closest smaller item instead of an error, so a typo in an ID can quietly return another ID's data.
  • A lookup value smaller than the first item returns #N/A. Start the list at 0 (or the lowest possible value) for banded lookups.
  • In the vector form, keep the lookup vector and result vector the same size and starting on the same row, so each position lines up.
  • The array form returns from the last column. If you insert a column at the end of the table, the answer changes.

Questions people ask

Is LOOKUP still worth using?

For banded lookups on sorted data and for the last-entry tricks, yes. For anything exact, use XLOOKUP, INDEX/MATCH or VLOOKUP with FALSE, because LOOKUP can't be told to match exactly.

What is the difference between LOOKUP and VLOOKUP?

VLOOKUP searches the first column of a table and returns a column by number, and can match exactly with FALSE. LOOKUP always matches approximately, takes separate search and result ranges, and so can return from the left of the search column.

Why does LOOKUP return #N/A?

The lookup value is smaller than every item in the lookup vector. Add a first row at 0 or the lowest possible value, or wrap the formula in IFNA.

How do I find the last value in a column?

For a number, `=LOOKUP(9.99E+307, A:A)`. For the last text entry in Microsoft 365, use `=XLOOKUP("*", A:A, A:A, , 2, -1)`.

Learn LOOKUP in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.