How to Use MATCH Function in Excel? - ExcelDemy (2024)

In this article, we are going to demonstrate various examples of using the MATCH function in Excel based on different criteria, and what to do when this function doesn’t work.

How to Use MATCH Function in Excel? - ExcelDemy (1)

Introduction to MATCH Function in Excel

The MATCH function in Excel is used to locate the position of a lookup value in a row, column, or table, and returns the relative position of an item in an array that matches a specified value in a specified order.

How to Use MATCH Function in Excel? - ExcelDemy (2)

  • Syntax:

=MATCH(lookup_value,lookup_array,[match_type])

  • Arguments Explanation:
ArgumentRequired/OptionalExplanation
lookup_valueRequiredThe value to match in the array
lookup_arrayRequiredA range of cells or an array reference in which to lookup the value
match_typeOptionalSpecifies how Excel matches lookup_value with values in the lookup_array. 1 = exact or next smallest, 0 = exact match and -1 = exact or next largest
  • Return Value:

Returns the lookup value’s relative position.

  • Available Version:

From Excel 2003 onwards.

How to Use MATCH Function in Excel: 8 Practical Examples

To demonstrate the uses of the Match function, we’ll use the following dataset containing some “Products” with their ‘Price” and ‘Serial Numbers” tofind out the exact or approximate match for our search value.

How to Use MATCH Function in Excel? - ExcelDemy (3)

We used the Microsoft 365 version of Excel here, but the methods should work in any other version from Excel 2003 onwards.

Example 1 – Finding the Position of a Value

1.1 – Exact Match

For an exact match, simply set the matching_criteria argument to 0.

Steps:

  • In cell C12, enter the following formula.

=MATCH(D11, C5:C9,0)

The lookup_value is cell D11, the lookup_array is C5:C9, and the matching_criteria is 0 for an exact same match. So this MATCH function returns the position in the lookup_array of the exact value in cell D11.

How to Use MATCH Function in Excel? - ExcelDemy (4)

1.2 – Approximate Match

In most cases, rather than an exact match, an approximate match is used for numbers.

Steps:

  • Insert the below formula in cell D12:

=MATCH(D11,D5:D9,1)

Here, the D5:D9 cell range is the lookup_array. Since an approximate match is our target, we set 1 in the match_type field, which returns the nearest smallest value to the lookup_value. 300 is the nearest value to 335, so our formula returned the position of 3.

How to Use MATCH Function in Excel? - ExcelDemy (5)

1.3 – Specific Text Match

The MATCH function can also take text as its lookup value, as opposed to the cell reference used above. This is useful if you want to find the value or position of particular text in your dataset without knowing the cell reference.

Steps:

  • Enter the following formula in cell D12:

=MATCH(“Pants”, C5:C9,0)

The formulatakes the lookup_valuePants” and searches for an exact match in the lookup_array C5:C9.

How to Use MATCH Function in Excel? - ExcelDemy (6)

1.4 – Wildcard Match

You can also match text partially and return the position of the partial match in the dataset using a wildcard. For example, to find out the position for the product “Pants“, we can use the wildcard ” Pa*” instead of the full text.

Steps:

  • Enter the below formula in cell C12:

=INDEX(C5:C9, MATCH(“Pa*”, B5:B9,0))

Here, the MATCH function finds an exact match (matching_criteria = 0) in the lookup_array of B5:B9 for the lookup_value Pa*. Then the INDEX function takes the result of the MATCH function and finds the relation between the C5:C9 array and the Pa* text.

How to Use MATCH Function in Excel? - ExcelDemy (7)

Example 2 – Finding a Value Corresponding to Another Value

We can also find a value corresponding to another value by using the INDEX function along with the MATCH function. The INDEX function returns the value at a given location in a range or array. Then the MATCH function checks for the match.

Steps:

  • In cell C12 insert the following formula:

=INDEX(C5:C9, MATCH(C11, B5:B9,0))

B5:B9 is the array where we need to find the value. Using the MATCH function, we set the row_number,here 2. Then, from the array B5:B9, the INDEX function returns the value in the position of row 2.

How to Use MATCH Function in Excel? - ExcelDemy (8)

Example 3 – Applying the MATCH Function in Array Formula

We also need the INDEX function to use the MATCH function in an array formula.

Steps:

  • In cell C14 enter the following formula:

=INDEX(D5:D10, MATCH(1,(C12=B5:B10)*(C13=C5:C10),0))

Here we use 1 as the lookup_value in MATCH. The lookup_array is combined by multiplying the results from checking two criteria within their respective columns.

The (C12=B5:B10) and (C13=C5:C10) criteria provide an array of TRUE or FALSE. By multiplying the arrays, another array of TRUE and FALSE is formed. TRUE can be represented as 1, so we are looking for the position of the TRUE value inside the array.

Since this is an array formula, press CTRL + SHIFT + ENTER to execute it if you’re not a Microsoft 365 subscriber (where just pressing Enter will suffice).

How to Use MATCH Function in Excel? - ExcelDemy (9)

Example 4 – Utilizing Case-Sensitive MATCH Formula

For case-sensitive text, use the EXACT function and then the MATCH function to match the criteria. The structure of the formula is slightly different from that of the MATCH function formulas used in the above examples.

Steps:

  • Enter the following formula in cell D12:

=MATCH(TRUE, EXACT(C5:C9, D11),0)

The EXACT(C5:C9, D11) syntax returns an exact match in the lookup_array C5:C9, and the logical argument TRUE represents the existing value from the EXACT function.

How to Use MATCH Function in Excel? - ExcelDemy (10)

But when we use a lowercase letter in the lookup_value then it returns #N/A. So this formula works accurately, because an exact, case-sensitive match is required.

How to Use MATCH Function in Excel? - ExcelDemy (11)

Example 5 – Comparing Two Columns Using ISNA and MATCH Functions

Suppose we have a dataset of 2 lists, and we want to compare the 2nd list with the 1st one and return the values that don’t appear in the first list. We can do this using the ISNA and MATCH functions, along with the IF function to display the logical result in text format.

How to Use MATCH Function in Excel? - ExcelDemy (12)

Steps:

  • In cell D5 enter the following formula:

=IF(ISNA(MATCH(C5, B5:B12,0)), “Not in List 1″,””)

Here, the MATCH function in Excel returns TRUE for an exact match and FALSE otherwise. Then the ISNA function flips the results received from the MATCH function. Finally, the IF function returns the logical output as text.

How to Use MATCH Function in Excel? - ExcelDemy (13)

Example 6 – Applying the MATCH Function Between Two Columns

Suppose we have a list of products that match a previous column, and we want to put the value of “Price” that is an exact match in our new column. To do this, we need to use the INDEX and MATCH functions together.

Steps:

  • In cell F5 enter the formula below:

=INDEX($C$5:$C$12, MATCH(E5,$B$5:$B$12,0))

This formula compares the text between columns B and E and returns the matching value.

How to Use MATCH Function in Excel? - ExcelDemy (14)

Example 7 – Use the MATCH Function with VLOOKUP in Excel

When using the VLOOKUP function to look up a value from a dataset, deleting or inserting any column from that dataset will break the function.

In that case, use the MATCH function with VLOOKUP to do the task. To look up the Sales value of a product, we can use the following formula:

=VLOOKUP(G4,$B$4:$D$9,MATCH($F$5,$B$4:$D$4,0),FALSE)

How to Use MATCH Function in Excel? - ExcelDemy (15)

In the formula, we use the cell range B4:D9 as table_array. Now, if we delete the Quantity column, the formula will change the table_array to B4:C9 and show the result.

How to Use MATCH Function in Excel? - ExcelDemy (16)

Example 8 – Apply HLOOKUP with the MATCH Function to Lookup Values in a Horizontal Dataset

Similarly, use the HLOOKUP function to look up values in a horizontal dataset. Use the following formula to do that:

=HLOOKUP(C8,B4:G6,MATCH(B9,B4:B6,0),FALSE)

How to Use MATCH Function in Excel? - ExcelDemy (17)

Read More: Excel MATCH Function Not Working

Frequently Asked Questions

1 – Is the MATCH function better than the VLOOKUP function?

No, the VLOOKUP function is better as it returns a value rather than the position of a value like the MATCH function. However, by combining these two functions you can look for a value from a dataset, and deleting any row or column will not change the result.

2 – What does the MATCH function return if no match is found?

The error value #N/A.

3 – Can the MATCH function work with both rows and columns?

Yes. The lookup_array can be a single row or a single column.

4 – Can the MATCH function figure out the difference between uppercase and lowercase values?

No.

Download Practice Workbook

Download the following practice workbook. It will help you to realize the topic more clearly.

Uses of MATCH Function.xlsx

<< Go Back toExcel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
How to Use MATCH Function in Excel? - ExcelDemy (2024)

FAQs

How do you use match () in Excel? ›

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. For example, if the range A1:A3 contains the values 5, 25, and 38, then the formula =MATCH(25,A1:A3,0) returns the number 2, because 25 is the second item in the range.

How to use if function to match text in Excel? ›

How To Use If Function With Text In Excel: Finding Exact Text
  1. Here is a sample formula to show how this can be done: =IF(EXACT(A2,abc),1,0)
  2. This formula will return 1 if there is an exact match and will return 0 in case of no match.
  3. 3.As you can see that there is no exact match, so it has returned us 0.
Feb 13, 2023

What is the formula for matching cells in Excel? ›

The formula is =IF(AND(A2=B2, A2=C2), “Full match”, “”). And the formula to find matches in any two cells in the same row is =IF(OR(A2=B2, B2=C2, A2=C2), “Match”, “”).

How to match two criteria in Excel? ›

To perform an INDEX MATCH with multiple criteria in Excel, simply use an ampersand (&) to place multiple references in your lookup value and lookup array inputs in the MATCH formula.

How do I compare two lists in Excel to find matches? ›

To compare two columns in Excel row-by-row, use the following formulas:
  1. =IF(A2 = B2, “match”, “ ”)
  2. =IF(A2<>B2, “no match”, “ ”)
  3. =IF(A2 = B2, “match”, “no match”)
Jun 5, 2024

What is the exact match function in Excel? ›

Compares two text strings and returns the logical value TRUE if they are exactly the same, FALSE otherwise. EXACT is case-sensitive. Use EXACT to test text being entered into a document.

How do you put 3 conditions in if Excel? ›

To put three conditions in an IF formula in Excel, you can use nested IF functions, or use the IFS function instead. To nest multiple IF functions, use the following format =IF(logical_test1, IF(logical_test2, IF(logical_test3,…),…),…).

How to do if with two conditions? ›

The Excel IF function with two or more conditions follows a generic formula: =IF(AND(condition1, condition2, ...), value_if_true, value_if_false). What this means is that “If condition 1 is true AND condition 2 is true, return value_if_true; else return value_if_false.”

How do I match data in two cells in Excel? ›

Comparing Two Columns in Excel with the Equals Operator. You can compare two columns, row by row, and find the matching data by returning the result as Match or Not Match. The formula used is =column1=column2, and by default, Excel returns a True if there's a match or else False.

How to use VLOOKUP to match? ›

In its simplest form, the VLOOKUP function says: =VLOOKUP(What you want to look up, where you want to look for it, the column number in the range containing the value to return, return an Approximate or Exact match – indicated as 1/TRUE, or 0/FALSE).

What is the formula for match text to number in Excel? ›

The heart of this formula is a basic INDEX and MATCH formula, used to translate text values into numbers as defined in a lookup table. For example, to translate "EX" to the corresponding number, we would use: =INDEX(value,MATCH("EX",code,0)) which would return 4.

How to use the match function? ›

Examples of using the MATCH function in Excel

For example, if you want to find the value "2" or a lower value, you can enter "2" into a blank cell on the spreadsheet, such as cell B1. After you input the value, you can type the MATCH or XMATCH function to find the next closest value.

How to lookup value in Excel with 2 conditions? ›

One easy way of performing a multiple criteria lookup is by using XLOOKUP with the "&" operator that concatenates all the criteria into one lookup value and their corresponding lookup columns into one lookup array. This approach is more efficient than using VLOOKUP because you don't need the helper column.

How to use index and match formula? ›

How to use the INDEX Formula? To use INDEX MATCH in Excel, first identify the range where you want to look up a value. Use MATCH to find the row number where your lookup value is located. Then, use INDEX to retrieve the value from the specific row and column you need.

How do I match two columns in Excel? ›

You can compare two columns using the IF condition in Excel. The formula to compare two columns is =IF(B4=C4,”Yes”,” ”). It returns the result as Yes against the rows that contain matching values, and the remaining rows are left empty. The same formula can identify and return the mismatching values.

How to use match function in Excel with VLOOKUP? ›

In its simplest form, the VLOOKUP function says: =VLOOKUP(What you want to look up, where you want to look for it, the column number in the range containing the value to return, return an Approximate or Exact match – indicated as 1/TRUE, or 0/FALSE).

How to nest a match function in Excel? ›

Click the cell where you want to add the nested functions. Click the Formulas tab. Click the Lookup & Reference button in the Function Library group. You will start with the INDEX function and nest the MATCH function within it.

Top Articles
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 6319

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.