How to Use the LOOKUP Function in Excel

Easily find values in ranges or arrays

What to Know

  • The LOOKUP function in Excel is used to look up information in a row or column.
  • There are two ways to use a LOOKUP formula, depending on your needs: as a vector and an array.
  • The vector type searches only one row or column, while an array searches multiple rows and columns.

This article explains how to use the LOOKUP function in any version of Excel including Excel 2019 and Microsoft 365.

What is the LOOKUP Function?

The LOOKUP function in Excel is used to look up information in a row or column. It locates a value from the same position in the row or column as the starting value, so it's really useful when dealing with structured tables where all the rows and columns contain similar data.

There are two ways to write a LOOKUP formula in Excel depending on your needs. One form is called vector and the other is array.

LOOKUP function Excel examples

The LOOKUP function can be used in every version of Excel.

LOOKUP Function Syntax & Arguments

There are two ways to use the LOOKUP function:

Vector

The vector form searches through one row or one column only. That range is called the vector. The value that's returned is whatever is in the same position as the other selected data set.

=LOOKUP(lookup_value, lookup_vector, [result_vector])

  • lookup_value is the value the function should look for within the vector. It can be a number, text, logical value, name, or reference. This argument is required.
  • lookup_vector is the range. It can be a single row or a single column. The values in the vector must be in ascending order (e.g., 1, 2, 3 or A, B, C). This argument is required.
  • result_vector is an optional range. If used, it must be the exact same size as lookup_vector.

Here are some more rules to remember when you use the vector form of the LOOKUP function:

  • If lookup_value is smaller than the smallest value in lookup_vector, Excel produces the error #N/A.
  • If lookup_value can't be found, the LOOKUP function matches the largest value in lookup_vector that's less than or equal to lookup_value.

Array

The array form can search for a value in multiple rows and columns. It first locates the specified value in the first row or column of the selection and then returns the value of the same position in the last row or column.

=LOOKUP(lookup_value, array)

  • lookup_value is the value the function should look for within the array. It can be a number, text, logical value, name, or reference. The values must be in ascending order (e.g., 1, 2, 3 or A, B, C). This argument is required.
  • array is the range of cells that contain the value you're comparing with lookup_value. This argument is required.

Also keep these rules in mind:

  • If lookup_value can't be found, the largest value in array that's less than or equal to lookup_value is used instead.
  • If lookup_value is smaller than the largest value in the first row or column, the error #N/A is returned.
  • If array includes more columns than rows, the LOOKUP function searches for lookup_value in the first row.
  • If array includes more rows than column, the LOOKUP function searches for lookup_value in the first column.

LOOKUP Function Examples

Following are several examples of how to use LOOKUP in your formulas:

Use Lookup Vector to Search Table

=LOOKUP(1003,A2:A5,C2:C5)
LOOKUP Excel function example

Here's an example of how to use the LOOKUP function when we need to check the price in a table that's organized by part number. Since we know that the part numbers are listed in A2:A5 and the prices are in C2:C5, we can search for part number 1003 using those parameters.

Use Lookup Array to Search Table

=LOOKUP(1003,A2:C5)
LOOKUP array function example in Excel

The other way to use the LOOKUP function on the same set of data as the example above, is with an array. Instead of choosing two single columns, we're selecting the entire table. However, since we need the price in this example, we're stopping the selection at column C since the function will grab whatever value is found in the same position in the last column.

Find Closest Number in Table

=LOOKUP(A2,D2:D6,F2:F6)
Excel LOOKUP function examples

This LOOKUP formula is cross-referencing the score in column A with the grading system in column D. The LOOKUP function sees where the score falls on the grading system, and then it looks up the grade in F2:F6 to know what to write next to the score. Since some of those values aren't found in the table to the right, LOOKUP uses the next lowest value.

This particular formula could also be written in array form like this:

=LOOKUP(A2,D2:F6)

The results are the same since column D is the start of the selection and the end, which holds the grade, is column F.

Dollar signs can be used in formulas so that when you drag them down a column to apply the function to other cells, the references don't also get dragged. You can read more about mixed cell references here.

Locate Last Number in List

=LOOKUP(9.99999999999999E+307,A:A)
LOOKUP formula that finds the last number in a list

The LOOKUP formula finds the last number in column A. Since 9.99999999999999E+307 is the biggest number you can have in an Excel worksheet, the formula will show the last number in the list, even if there are blank cells included in the range.

Locate Last Text Value in List

=LOOKUP(REPT("z",255),A:A)
LOOKUP Excel formula that finds the last text value in a list

The example locates the last text value from column A. The REPT function is used here to repeat z to the maximum number that any text value can be, which is 255. Similar to the number example, this one simply identifies the last cell that contains text.

Use Table Data to Find Heading Values

=LOOKUP(2,1/(B3:G3 <> ""),B$2:G$2)
Excel function LOOKUP examples

This final example of the Excel LOOKUP function involves some things not described in this article, but it's worth a look anyway so that you can see just how useful this function can be. The general idea here is that we're determining the last entry in each row and then looking up the date in row 2 to know the last time we paid those bills.

Other Functions Like LOOKUP

LOOKUP is a fairly basic lookup/reference function. Others exist that are good for more advanced uses.

VLOOKUP and HLOOKUP let you perform vertical or horizontal lookups and can specify whether to do an exact or approximate match. LOOKUP automatically returns the closest value if an exact match isn't found.

XLOOKUP is a similar, more advanced lookup function.