1. 程式人生 > >Excel資料分析與業務建模_第四章_匹配函式MATCH(語法詳解及應用例項)

Excel資料分析與業務建模_第四章_匹配函式MATCH(語法詳解及應用例項)

如果有一天,EXCEL中沒有了LOOKUP函式,怎麼辦?答案是就靠MATCH和INDEX兩兄弟了。

MATCH函式可返回指定區域內指定內容所在的行號(縱向區域)或列號(橫向區域)。

Suppose you have a worksheet with 5,000 rows containing 5,000 names. You need to find the name John Doe, which you know appears somewhere (and only once) in the list. Wouldn’t you like to know of a formula that would return the row number that contains that name? The MATCH function enables you to find the first occurrence of a match to a given text string or number within a given array. You should use the MATCH function instead of a lookup function when you want the position of a number in a range rather than the value in a particular cell. The syntax of the match function is:
Match(lookup value,lookup range,[match type])
In the explanation that follows, assume that all cells in the lookup range are in the same column. In
this syntax:
■ Lookup value is the value you’re trying to match in the lookup range.
■ Lookup range is the range you’re examining for a match to the lookup value. The lookup range must be a row or column.
■ Match type=1 requires the lookup range to consist of numbers listed in ascending order. The MATCH function then returns the row location in the lookup range (relative to the top of the lookup range) that contains the largest value in the range that is less than or equal to the lookup value.
■ Match type=–1 requires the lookup range to consist of numbers listed in descending order.
The MATCH function returns the row location in the lookup range (relative to the top of the lookup range) that contains the last value in the range that is greater than or equal to the lookup value.
■ Match type=0 returns the row location in the lookup range that contains the first exact matchto the lookup value. (Chapter 19, “COUNTIF, COUNTIFS, COUNT, COUNTA, and COUNTBLANK functions,” discusses how to find the second or third match.) When no exact match exists and match type=0, Excel returns the error message #N/A. Most MATCH function applications use match type=0, but if match type is not included, match type=1 is assumed. Thus, use match type=0 when the cell contents of the lookup range are unsorted. This is the situation you usually face.

應用例項:

給出一個投資收益表,如何查詢投資回報期(累積收益大於等於累積投資)。