Sie sind auf Seite 1von 3

Excel MATCH Function

Related Function:
CHOOSE Function
Match and Choose Functions

The Excel Match and Choose functions both work with arrays of data.

 The Match function receives a value to lookup, and returns the postion of the value in the
array.
 The Choose function receives a position and returns the value that has this position in the
array.

Basic Description
The Excel Match function looks up a value in an array, and returns the relative position of the
value within the array. The user can request either an exact match or can request the position of
the closest match (above or below), if an exact match is not found.

The syntax of the Match function is:

MATCH( lookup_value, lookup_array, [match_type] )

Where the arguments are as follows:

lookup_value - The value that you want to look up


lookup_array - The data array that is to be searched
An optional logical argument, which can set to 1, 0 or -1 to return the
[match_type] -
following results:
if the function cannot find an exact match, it should use the closest match below the
1 -
lookup_value. (If this option is used, the lookup_array must be in ascending order).
if the function cannot find an exact match, it should return an error. (If this option is used,
0 -
the lookup_array does not need to be ordered).
if the function cannot find an exact match, it should use the closest match above the
-1 -
lookup_value. (If this option is used, the lookup_array must be in descending order).

Wildcards

You can also use the following wildcards in text matches:

?    -    matches any single character


*    -    matches any sequence of characters
if you do actually want to find the ? or * character, type the ~ symbol before this character in
your search.

eg. the condition "A*e" will match all cells containing a text string beginning with "A" and
ending in "e".

The Match function can be used to match numeric values, logical values, or text strings. Note
that, when used with text strings, the function is NOT case-sensitive. So, for example, the text
strings "TEXT" and "text" will be considered to be a match.

Wildcards can be used with text strings, when the [match_type] argument is set to 0 (requiring an
exact match). This is illustrated in the examples below.

Excel Match Function Example 1


The following spreadsheet shows the Excel Match function used with the [match_type] argument
set to 0. Therefore, in these examples, the function only returns a result if an exact match to the
lookup_value is found. Otherwise, the function returns an error.

In each case, the lookup_array is the range of cells A1 - A5.

 Formulas:  Results:

  A B   A B C
1 cccc =MATCH( "aaaa", A1:A5, 0 ) 1 cccc 3 - matches "aaaa" so returns position 3
2 dddd =MATCH( "?eee", A1:A5, 0 ) 2 dddd 5 - matches "eeee" so returns position 5
3 aaaa =MATCH( "*b", A1:A5, 0 ) 3 aaaa 4 - matches "bbbb" so returns position 4
4 bbbb   4 bbbb    
5 eeee   5 eeee    

Note that, in the above examples, as the [match_type] argument is set to 0, the text strings in the
lookup_array (cells A1-A5) do not need to be ordered.

Match Function Example 2


The following spreadsheet also shows the Excel MATCH function used with the [match_type]
argument set to 0, but in this case the function is used to look up numeric values.

In these examples, the lookup_array is the range of cells A1 - A6.


 Formulas:  Results:

  A B   A B C
1 7 =MATCH( 4, A1:A6, 0 ) 17 3 - returns position 3
2 2 =MATCH( 8, A1:A6, 0 ) 22 5 - returns position 5
3 4 =MATCH( 10, A1:A6, 0 ) 3 4 #N/A - no exact match - returns error
41   41    
58   58    
6 11   6 11    

As in the previous examples, as the [match_type] argument is set to 0, the values in the
lookup_array (cells A1-A6) do not need to be ordered.

Match Function Example 3


The following spreadsheet shows the Excel MATCH function used with the [match_type]
argument set to 1. Therefore, in this example, the data in the lookup_array must be in ascending
order, and the function returns the position of the exact match to the lookup_value if this is
found, or the position of the closest value below the lookup_value if an exact match is not found.

 Formulas:  Results:

  A B   A B C
1 4 =MATCH( 6, A1:A6, 1 ) 14 2 - returns position 2
2 6 =MATCH( 8, A1:A6, 1 ) 26 3 - returns position 3 (closest value below 8)
3 7 =MATCH( 15, A1:A6, 1 ) 37 5 - returns position 5 (closest value below 15)
4 10   4 10    
5 11   5 11    
6 16   6 16    

Note that the [match_type] argument could have been omitted from the functions in the above
spreadsheet, as this argument has the value 1 by default.

Further information and examples of the Excel Match Function can be found on the Microsoft
Office website.

Das könnte Ihnen auch gefallen