General lookup.
Syntax:
LOOKUP(key, lookup:Array|Range, result:Array|Range {, all:Number})
Returns the value in the result array or range of cells corresponding to the position that key holds in the lookup array or range of cells.
key can be a date, string or number.
If key is a string,
it can include the wildcards ^?
(any single character) or ^#
(multiple characters).
If an exact match for key is found in the lookup array, the function returns the corresponding element from the result array.
If key is not found in the lookup array, an error message is returned.
If the optional fourth parameter all is supplied and set to 1
,
the result is an array containing all the rows of the
result array for which the key was found in the
lookup array.
Example:
LOOKUP("Mark", B1:B10, B1:E10, 1)
returns an array which is all of the rows of B1:E10
for which the value in column B
is "Mark"
.