Lookup

Looks up a value in a search set and returns the corresponding value (with the same Index) in a set of results.

Syntax

Lookup(element, search_set, results_set)
element = element to search for in the search_set
search_set = the set of elements on which to run the search
results_set = the set of results returned, based on the search

Remarks

This function is equivalent to:

Index(results_set, IndexOf(search_set, element, 1))

Both of these sets can be either lists (see List), or else ranges, columns, rows or blocks. Normally, both sets should have the same size.

If results_set is smaller, and the search element falls outside of it, the function will return an empty value.

To retrieve all of the results for element, use LookupAll.

Examples

Lookup("a", List("a", "b"), List("alpha", "beta")) = "alpha"
Lookup("b", List("a", "b"), List("alpha", "beta")) = "beta"
Lookup("a", List("a", "b", "a"), List("alpha", "beta", "alpha2")) = "alpha"
Lookup(A4, A1:A10, B1:B10) = B4 (assuming that A1, A2, A3 are different from A4)

Classification

Ranges