Investment Studio > Expressions > Functions > Reference > HLOOKUP

hlookup(lookup_value, array[*][*] table, integer result_row = 1, boolean range_lookup = TRUE)

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

If result_row is omitted, it defaults to 1 (the top row, 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

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

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

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

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

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

returns #N/A (no exact match to "hello").

See also index, lookup, match, vlookup.