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.

应用实例:

给出一个投资收益表,如何查找投资回报期(累积收益大于等于累积投资)。

Excel数据分析与业务建模_第四章_匹配函数MATCH(语法详解及应用实例)_第1张图片


你可能感兴趣的:(Excel数据分析与业务建模_第四章_匹配函数MATCH(语法详解及应用实例))