- Advanced Excel Functions Tutorial
- Advanced Excel Functions - Home
- Compatibility Functions
- Advanced Excel Functions - Cube
- Database Functions
- Date & Time Functions
- Engineering Functions
- Financial Functions
- Information Functions
- Advanced Excel Functions - Logical
- Lookup & Reference Functions
- Math & Trignometric Functions
- Statistical Functions
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
Lookup and Reference - MATCH Function
Description
The MATCH Function searches for a specified item in a range of cells, and then returns the relative position of that item in the range.
Use MATCH instead of one of the LOOKUP Functions when you need the position of an item in a range instead of the item itself. E.g. you can use the MATCH Function to provide a value for the row_num argument of the INDEX Function.
Syntax
MATCH (lookup_value, lookup_array, [match_type])
Arguments
Argument | Description | Required/ Optional |
---|---|---|
lookup_value | The value that you want to match in lookup_array. E.g. when you look up someone's number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want. The lookup_value argument can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value. |
Required |
lookup_array | The range of cells being searched. |
Required |
match_type | The number -1, 0, or 1. The match_type argument specifies how Excel matches lookup_value with values in lookup_array. The default value for this argument is 1. See below to know how the function finds values based on the match_type argument. |
Optional |
match_type | What MATCH Function Finds |
---|---|
1 or omitted |
MATCH finds the largest value that is less than or equal to lookup_value. The values in the lookup_array argument must be placed in ascending order, for example: ...-2, -1, 0, 1, 2... A-Z, FALSE, TRUE. |
0 |
MATCH finds the first value that is exactly equal to lookup_value. The values in the lookup_array argument can be in any order. |
-1 |
MATCH finds the smallest value that is greater than or equal to lookup_value. The values in the lookup_array argument must be placed in descending order, for example: TRUE, FALSE, Z-A ...2, 1, 0, -1, -2..., and so on. |
Notes
MATCH returns the position of the matched value within lookup_array, not the value itself. E.g. MATCH ("b",{"a","b","c"},0) returns 2, which is the relative position of "b" within the array {"a","b","c"}
MATCH does not distinguish between uppercase and lowercase letters when matching text values.
If MATCH is unsuccessful in finding a match, it returns the #N/A error value.
If match_type is 0 and lookup_value is a text string, you can use the wildcard characters - the question mark (?) and asterisk (*) - in the lookup_value argument
A question mark matches any single character
An asterisk matches any sequence of characters
If you want to find an actual question mark or asterisk, type a tilde (~) before the character
If the lookup_array not being ordered correctly, Match Function returns the wrong result
Match Function returns a #N/A error value when the Function fails to find a match for the lookup_value. This can happen
If match_type = 0 and an exact match for the lookup_value is not found within the lookup_array
If match_type = 1 or is omitted and the first value in the lookup_array is larger than the if match_type = 1 lookup_value (i.e., the array is in ascending order and there is no closest match below or equal to the lookup_value).
If match_type = -1 and the first value in the lookup_array is smaller than the lookup_value (and therefore, if the array is in descending order, there is no closest match above or equal to the lookup_value).
If there are unseen characters in either the lookup_value or the values in the lookup_array.
If lookup_value and the data in the lookup_array have different data types.
Applicability
Excel 2007, Excel 2010, Excel 2013, Excel 2016