Lookup
LOOKUP Function¶
The LOOKUP function in Excel is used to search for a value in a row or column range and returns a corresponding value from a different row or column.
Syntax:¶
There are two forms of the LOOKUP function:
-
Vector form:
LOOKUP(lookup_value, lookup_vector, [result_vector])
-
lookup_value: The value you want to search for.
- lookup_vector: A range that contains only one row or one column. The values in this range should be sorted in ascending order.
-
result_vector (optional): A range that contains only one row or one column. It must be the same size as
lookup_vector. -
Array form:
LOOKUP(lookup_value, array)
-
lookup_value: The value you want to search for.
- array: A range of cells containing text, numbers, or logical values.
Examples:¶
- Vector form: Assuming
A1:A4contains{1, 2, 3, 4}andB1:B4contains{"A", "B", "C", "D"}, the formula=LOOKUP(3, A1:A4, B1:B4)would return"C". - Array form: Given the same ranges, the formula
=LOOKUP(3, A1:B4)would return3becauseLOOKUPin array form returns a value from the same row but the last column of the array.
Note: Where an array is used: {"A", "B", "C", "D"} then this does not create a table, but instead is put in memory. This is compatible with WASM.
Note: The
LOOKUPfunction will return the largest value less than or equal tolookup_valueif an exact match is not found. This is why it is important thatlookup_vectoris sorted in ascending order for the vector form. Iflookup_valueis smaller than the smallest value inlookup_vector, theLOOKUPfunction will return an error.