水平查詢。橫向搜尋特定範圍中的第一列是否有指定準則,並將找到的資料欄中指定儲存格的值傳回。
使用範本
HLOOKUP(10003, A2:Z6, 2, FALSE)
語法
HLOOKUP(搜尋詞, 範圍, 索引, [已排序])
search_key
要尋找的值,舉例來說,-42
,貓
, orI24
.範圍
搜尋的指定範圍。The first row in the range is searched for the key specified insearch_key
.索引
- The row index of the value to be returned, where the first row in範圍
is numbered 1.- IF
索引
is not between 1 and the number of rows in範圍
,#VALUE!
is returned.
- IF
已排序
- [OPTIONAL -TRUE
by default] - Indicates whether the row to be searched (the first row of the specified range) is sorted.IF
已排序
isTRUE
or omitted, the nearest match (less than or equal to the search key) is returned. If all values in the search row are greater than the search key,無法使用
is returned.IF
已排序
is set toTRUE
or omitted, and the first row of the range is not in sorted order, an incorrect value might be returned.IF
已排序
isFALSE
, only an exact match is returned. IFthere are multiple matching values, the content of the cell corresponding to the first value found is returned, and無法使用
is returned if no such value is found.
附註
When searching for numeric or date values, make sure that the first row in the range is not sorted by text values. 舉例來說,correctly sorted numbers should appear as (1, 2, 10, 100) rather than (1, 10, 100, 2) as they would be if they were sorted as strings. Using an incorrect sort type may cause incorrect values to be returned.
Search keys based on regular expressions or wildcard patterns are 不支援的功能Use
QUERY
instead.HLOOKUP has much better performance with sorted ranges and
已排序
set toTRUE
. Consider sorting the row being searched.
另請參閱
QUERY
: 對多筆資料執行 Google Visualization API Query Language 查詢作業。
VLOOKUP
: 垂直查詢。縱向搜尋特定範圍中的第一欄是否有指定準則,並將找到的資料列中指定儲存格的值傳回。
範例
在本範例中,
HLOOKUP
searches across the first row for a
student ID and returns the corresponding grade.
在本範例中,
HLOOKUP
searches across the first row for the
income using approximate match ( 已排序
is set to TRUE
以及returns the corresponding tax rate.
在本範例中,
HLOOKUP
returns the first value found when there are multiple
matches for the search_key
.