LOOKUP

Looks for a key in a single row or column sorted in ascending order and returns a corresponding value from another single row or column.

Parameter List

Syntax
LOOKUP(search_keysearch_range|search_result_array
[result_range]
)
search_key

The value to search for in a row, e.g. "Super", 123, A2, or "Benf*".

search_range|search_result_array

The two-dimensional range or JSON data to consider for the search. The first column must include the search_key. For example: A1:C5.

[optional] result_range

The range from which to return a result.

More details

The way to search.

  • Use 0 when you want the first exact match in a range that is not ordered.

  • Use 1 when the range is sorted in ascending order and you want the position of the largest value that is less than or equal to the search key.

  • Use 2 when the range is sorted in descending order and you want the smallest value that is greater than or equal to the search_key.

    The function accepts values for both axes (column and row). For example: 01, 10, 11, or 22.

If you use 1 or 2 in any of the axis (column or row) and the ranges are not properly ordered, the outcome can be unpredictable.

Examples

LOOKUP(A1:B3, "iPhone X", "price", 00) returns 899