Excel - MATCH Function



MATCH Function

The Excel MATCH extracts the relative position of the searched item in the table. It is a part of the LOOKUP and REFERENCE function. You may also combine the MATCH function with the INDEX function in Excel for advanced data search.

For example, suppose you wish to identify the relative position of the sales executive's incentive in a dataset. The MATCH function can first look up the sales executive's name in the array and then retrieve its relative position.

Compatibility

This advanced Excel function is compatible with the following versions of MS Excel –

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the MATCH function is as follows −

=MATCH(lookup_value, lookup_array, [match_type])

Arguments

You can use the following arguments with the MATCH function −

Argument Description Required / Optional
lookup_value

It may contain a numeric value, text string, Boolean value, or cell reference that points to specific types of data like (TRUE/FALSE, numbers, or text string).

The actual data is to be extracted by matching the lookup_array.

Required
lookup_array It specifies the range of cells or a table where the value will be searched. Required
match_type

It may contain three numeric values: -1, 0, or 1(default value if skipped in this argument).

The match_type indicates how Excel matches lookup_value with data in the defined array.

The following details are provided when choosing the match_type argument.

Optional
match_type What MATCH Function Finds
1 or omitted

The MATCH function extracts the most significant value, equal to or smaller than the lookup_value.

The lookup_array argument must specify the values in ascending order.

0 The MATCH function retrieves the first value that exactly matches the lookup_value. The lookup_array may specify the values either in ascending or descending order.
-1

MATCH finds the smallest value that is greater than or equal to lookup_value.

The lookup_array argument must specify the values in ascending order.

Points to Remember

  • The MATCH function does not extract the actual data but retrieves the relative position of the matching data in the lookup_array.
  • The MATCH function ignores the case differences when matching the values in the lookup_array.
  • If the match is not found in the look_array argument, the MATCH function will return the #N/A error.
  • If match_type is 0 and lookup_value is a text string, you can use the wildcard characters like (?) and (*) - in the lookup_value argument
    • A question mark(?) is used to match any single character.
    • An asterisk(*) is used to match any sequence of characters.
    • You may type a tilde(~) before the character to get the asterisk or the exact (?).
  • If the lookup_array argument is not sorted perfectly, then, in this case, the Match Function will retrieve the inaccurate result.
  • If the MATCH function cannot find a perfect match for the lookup_value, then the function will return the #N/A error. Several cases are written below −
    • 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 the lookup_value or the values in the lookup_array.
    • If lookup_value and the data in the lookup_array have different data types.

Example of MATCH Function

Practice the following example to learn the use of the MATCH function in Excel.

What does the MATCH Function do in Excel?

In this example, the value within the array is scrutinized, and its relative position is extracted using the MATCH function.

Step 1 − First, consider the sample dataset, which demonstrates the production sales of the different regions for the first three months. The task is to apply the MATCH function to find the position of the lookup value in the cell range B2:E6.

What does the MATCH Function do in Excel1

Step 2 − After that, double click on the D9 cell and type the formula =MATCH(D8,B1:B6) in it, and hit the Enter tab. Here, the D8 cell reference points to the "South" text being searched in the cell range B1:B6.

What does the MATCH Function do in Excel2

After that, hit the Enter tab.

What does the MATCH Function do in Excel3

Step 3

What does the MATCH Function do in Excel4

Step 4 − Afterward, place the cursor on the D12 cell, write the formula =MATCH(D11,D3:D7) in it, and hit the Enter tab.

What does the MATCH Function do in Excel5

Then, press the Enter tab to evaluate the MATCH function.

What does the MATCH Function do in Excel6

Download Practice Sheet

You can download and use the sample data sheet to practice the MATCH function.

Advertisements