傳回與指定值相符的項目在範圍中的相對位置。
使用範本
MATCH("Sunday",A2:A9,0)
MATCH(DATE(2012,1,1),A2:F2)
語法
MATCH(search_key, range, search_type)
-
search_key
要尋找的值,舉例來說,-42
,貓
, orI24
. -
範圍
要搜尋的一維陣列。- If a range with both height and width greater than 1 is used,
MATCH
will return無法使用
.
- If a range with both height and width greater than 1 is used,
-
搜尋類型
- [ OPTIONAL -1
by default ] - The manner in which to search.-
1
, the default, causesMATCH
to assume that the range is sorted in ascending order and return the largest value less than or equal tosearch_key
. -
0
indicates exact match, and is required in situations where範圍
is not sorted. -
-1
慈善事業MATCH
to assume that the range is sorted in descending order and return the smallest value greater than or equal tosearch_key
.
-
附註
MATCH
returns the position in an array or range of a matched value rather than the value itself. To return the value itself or another value corresponding to the row or column the match is found in, useINDEX
,HLOOKUP
, orVLOOKUP
.
另請參閱
VLOOKUP
: 垂直查詢。縱向搜尋特定範圍中的第一欄是否有指定準則,並將找到的資料列中指定儲存格的值傳回。
HLOOKUP
: 水平查詢。橫向搜尋特定範圍中的第一列是否有指定準則,並將找到的資料欄中指定儲存格的值傳回。
INDEX
: 傳回以列偏移和欄偏移方式指定的儲存格內容。
範例
Returns the relative position of an item in an array that matches a specified value based on differnet 搜尋類型
.