XYLOOKUP

Search for a search key in the first column of a range and returns the value of a specified cell in the row corresponding to the selected column.

Parameter List

Syntax
XYLOOKUP(rangerow_key
[col_key]
[search_mode]
)
range

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

row_key

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

[optional] col_key

The value to search for in a column/header, e.g. "Telephone", A1, or "Addr*". By default, the function uses the first column.

[optional] search_mode

The way to search. The function accepts values for both axes (column and row). For example: 01, 10, 11, or 22. By default set to 00. For more information, click on Learn More.

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 row_key or col_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

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