LOOKUP

Microsoft Office Excel 2003

See Also

The LOOKUP function has two syntax forms: vector and array.

A vector is a range of only one row or one column. The vector form of LOOKUP looks in a one-row or one-column range (known as a vector) for a value and returns a value from the same position in a second one-row or one-column range. Use this form of the LOOKUP function when you want to specify the range that contains the values you want to match. The other form of LOOKUP automatically looks in the first column or row.

Syntax 1

Vector form

LOOKUP(lookup_value,lookup_vector,result_vector)

Lookup_value    is a value that LOOKUP searches for in the first vector. Lookup_value can be a number, text, a logical value, or a name or reference that refers to a value.

Lookup_vector    is a range that contains only one row or one column. The values in lookup_vector can be text, numbers, or logical values.

Important  The values in lookup_vector must be placed in ascending order: ...,-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE; otherwise, LOOKUP may not give the correct value. Uppercase and lowercase text are equivalent.

Result_vector    is a range that contains only one row or column. It must be the same size as lookup_vector.

Remarks

  • If LOOKUP can't find the lookup_value, it matches the largest value in lookup_vector that is less than or equal to lookup_value.
  • If lookup_value is smaller than the smallest value in lookup_vector, LOOKUP gives the #N/A error value.

Example

The example may be easier to understand if you copy it to a blank worksheet.

Show How?

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic. Do not select the row or column headers.

    Selecting an example from Help

    Selecting an example from Help

  3. Press CTRL+C.
  4. In the worksheet, select cell A1, and press CTRL+V.
  5. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
 
1
2
3
4
5
6
A B
Frequency Color
4.14 red
4.19 orange
5.17 yellow
5.77 green
6.39 blue
Formula Description (Result)
=LOOKUP(4.91,A2:A6,B2:B6) Looks up 4.19 in column A, and returns the value from column B that's in the same row (orange)
=LOOKUP(5.00,A2:A6,B2:B6) Looks up 5.00 in column A, and returns the value from column B that's in the same row (orange)
=LOOKUP(7.66,A2:A6,B2:B6) Looks up 7.66 in column A, matches the next smallest value (6.39), and returns the value from column B that's in the same row (blue)
=LOOKUP(0,A2:A6,B2:B6) Looks up 0 in column A, and returns an error because 0 is less than the smallest value in the lookup_vector A2:A7 (#N/A)