HLOOKUP
Syntax:
HLOOKUP ( lookup-value , table-array , row-index-num [ , [ range-lookup-flag ] ] )
Description: Performs a horizontal search for a value in the top row of a table or an array, noting the column in which the matching value is found. From that column, the value from a given row is returned.
Arguments:
Name |
Type |
Description |
---|---|---|
lookup-value |
value of any type or a reference to a value of any type. |
The value to be located in the first row of the table. If range-lookup is |
table-array |
array, reference, name |
Designates the table of information to be searched. The values in the first row of table-array can be text, numbers, or logical values. If range-lookup-flag is |
row-index-num |
number |
The row number in table-array from which the matching value is to be returned. (A row-index-num of 1 returns the first row value in table-array, a row-index-num of 2 returns the second row value in table-array, and so on.) |
range-lookup-flag |
logical |
Specifies whether |
Return Type and Value: any – The value from a given row number, where the column is determined by a search of the top row looking for a match with a given value.
However, if
An exact match is performed, but no match is found,
#N/A
is returned.row-index-num is less than 1,
#VALUE!
is returned.row-index-num is greater than the number of rows in table-array,
#REF!
is returned.lookup-value is smaller than the smallest value in the first row of table-array,
#N/A
is returned.
A |
B |
C |
|
---|---|---|---|
1 |
Axles |
Bearings |
Bolts |
2 |
4 |
6 |
9 |
3 |
5 |
7 |
10 |
4 |
6 |
8 |
11 |
HLOOKUP("Axles",A1:C4,2,TRUE)
results in 4
HLOOKUP("Bearings",A1:C4,3,FALSE)
results in 7
HLOOKUP("B",A1:C4,3,TRUE)
results in 5
HLOOKUP("Bolts",A1:C4,4)
results in 11
HLOOKUP(3,{1,2,3;"a","b","c";"d","e","f"},2,TRUE)
results in c
]