Investment Studio > Expressions > Functions > Reference > VLOOKUP

vlookup(lookup_value, array[*][*] table, integer result_column = 1, boolean range_lookup = TRUE)

Searches for lookup_value in the first column of the two-dimensional table array; if a match is found, the value in the matching row and column result_column is returned.

If result_column is omitted, it defaults to 1 (the first column, meaning that the matched value is returned).

If range_lookup is TRUE, matching is approximate: the largest value <= lookup_value is used. If range_lookup is FALSE, the first exact match is used.

If range_lookup is omitted, it defaults to TRUE.

The lookup_value and table values can be of any type. Matching follows the same rules as the comparison operators.

Examples

=vlookup("hello", {{1, 10}, {"hi", 20}, {"goodbye", 30}})

returns "goodbye" (closest match to "hello")

=vlookup("hello", {{1, 10}, {"hi", 20}, {"goodbye", 30}}, 2)

returns 30 (column 2 in row containing closest match to "hello")

=vlookup("hello", {{1, 10}, {"hi", 20}, {"goodbye", 30}}, 2, FALSE)

is an error (#N/A) since there is no exact match to "hello".

See also hlookup, index, lookup, match.