Use match in excel

MATCH function

Tip: Try using the new XMATCH function, an improved version of MATCH that works in any direction and returns exact matches by default, making it easier and more convenient to use than its predecessor.

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.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Tip: 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. For example, you might 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])

The MATCH function syntax has the following arguments:

  • lookup_value    Required. The value that you want to match in lookup_array. For example, 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.

  • lookup_array    Required. The range of cells being searched.

  • match_type    Optional. 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.

    The following table describes how the function finds values based on the setting of the match_type argument.

Match_type

Behavior

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 tolookup_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.

  • MATCH returns the position of the matched value within lookup_array, not the value itself. For example, 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.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Product

Count

Bananas

25

Oranges

38

Apples

40

Pears

41

Formula

Description

Result

=MATCH(39,B2:B5,1)

Because there is not an exact match, the position of the next lowest value (38) in the range B2:B5 is returned.

2

=MATCH(41,B2:B5,0)

The position of the value 41 in the range B2:B5.

4

=MATCH(40,B2:B5,-1)

Returns an error because the values in the range B2:B5 are not in descending order.

#N/A

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

This article explains in simple terms how to use INDEX and MATCH together to perform lookups. It takes a step-by-step approach, first explaining INDEX, then MATCH, then showing you how to combine the two functions together to create a dynamic two-way lookup. There are more advanced examples further down the page.

INDEX function | MATCH function | INDEX and MATCH | 2-way lookup | Left lookup | Case-sensitive | Closest match | Multiple criteria | More examples

The INDEX Function

The INDEX function in Excel is fantastically flexible and powerful, and you’ll find it in a huge number of Excel formulas, especially advanced formulas. But what does INDEX actually do? In a nutshell, INDEX retrieves the value at a given location in a range. For example, let’s say you have a table of planets in our solar system (see below), and you want to get the name of the 4th planet, Mars, with a formula. You can use INDEX like this:

=INDEX(B3:B11,4)

Using INDEX to get the name of the 4th planet
INDEX returns the value in the 4th row of the range.

Video: How to look things up with INDEX

What if you want to get the diameter of Mars with INDEX? In that case, we can supply both a row number and a column number, and provide a larger range. The INDEX formula below uses the full range of data in B3:D11, with a row number of 4 and column number of 2:

=INDEX(B3:D11,4,2)

Using INDEX to get the diameter of the 4th planet
INDEX retrieves the value at row 4, column 2.

To summarize, INDEX gets a value at a given location in a range of cells based on numeric position. When the range is one-dimensional, you only need to supply a row number. When the range is two-dimensional, you’ll need to supply both the row and column number.

At this point, you may be thinking «So what? How often do you actually know the position of something in a spreadsheet?»

Exactly right. We need a way to locate the position of things we’re looking for.

Enter the MATCH function.

The MATCH function

The MATCH function is designed for one purpose: find the position of an item in a range. For example, we can use MATCH to get the position of the word «peach» in this list of fruits like this:

=MATCH("peach",B3:B9,0)

Using MATCH to find position in a vertical range
MATCH returns 3, since «Peach» is the 3rd item. MATCH is not case-sensitive.

MATCH doesn’t care if a range is horizontal or vertical, as you can see below:

=MATCH("peach",C4:I4,0)

Using MATCH to find position in a horizontal range
Same result with a horizontal range, MATCH returns 3.

Video: How to use MATCH for exact matches

Important: The last argument in the MATCH function is match_type. Match_type is important and controls whether matching is exact or approximate. In many cases you will want to use zero (0) to force exact match behavior. Match_type defaults to 1, which means approximate match, so it’s important to provide a value. See the MATCH page for more details.

INDEX and MATCH together

Now that we’ve covered the basics of INDEX and MATCH, how do we combine the two functions in a single formula? Consider the data below, a table showing a list of salespeople and monthly sales numbers for three months: January, February, and March.

Sales by salesperson by month

Let’s say we want to write a formula that returns the sales number for February for a given salesperson. From the discussion above, we know we can give INDEX a row and column number to retrieve a value. For example, to return the February sales number for Frantz, we provide the range C3:E11 with a row 5 and column 2:

=INDEX(C3:E11,5,2) // returns $5194

But we obviously don’t want to hardcode numbers. Instead, we want a dynamic lookup.

How will we do that? The MATCH function of course. MATCH will work perfectly for finding the positions we need. Working one step at a time, let’s leave the column hardcoded as 2 and make the row number dynamic. Here’s the revised formula, with the MATCH function nested inside INDEX in place of 5:

=INDEX(C3:E11,MATCH("Frantz",B3:B11,0),2)

Taking things one step further, we’ll use the value from H2 in MATCH:

=INDEX(C3:E11,MATCH(H2,B3:B11,0),2)

INDEX and MATCH to find Feb sales for any name
MATCH finds «Frantz» and returns 5 to INDEX for row.

To summarize:

  1. INDEX needs numeric positions.
  2. MATCH finds those positions.
  3. MATCH is nested inside INDEX.

Let’s now tackle the column number.

Two-way lookup with INDEX and MATCH

Above, we used the MATCH function to find the row number dynamically, but hardcoded the column number. How can we make the formula fully dynamic, so we can return sales for any given salesperson in any given month? The trick is to use MATCH twice – once to get a row position, and once to get a column position.

From the examples above, we know MATCH works fine with both horizontal and vertical arrays. That means we can easily find the position of a given month with MATCH. For example, this formula returns the position of March, which is 3:

=MATCH("Mar",C2:E2,0) // returns 3

But of course we don’t want to hardcode any values, so let’s update the worksheet to allow the input of a month name, and use MATCH to find the column number we need. The screen below shows the result:

Dynamic lookup with INDEX and MATCH
A fully dynamic, two-way lookup with INDEX and MATCH.

=INDEX(C3:E11,MATCH(H2,B3:B11,0),MATCH(H3,C2:E2,0))

The first MATCH formula returns 5 to INDEX as the row number, the second MATCH formula returns 3 to INDEX as the column number. Once MATCH runs, the formula simplifies to:

=INDEX(C3:E11,5,3)

and INDEX correctly returns $10,525, the sales number for Frantz in March.

Note: you could use Data Validation to create dropdown menus to select salesperson and month. 

Video: How to do a two-way lookup with INDEX and MATCH

Video: How to debug a formula with F9 (to see MATCH return values)

Left lookup

One of the key advantages of INDEX and MATCH over the VLOOKUP function is the ability to perform a «left lookup». Simply put, this just means a lookup where the ID column is to the right of the values you want to retrieve, as seen in the example below:

Left lookup with INDEX and MATCH

Read a detailed explanation here.

Case-sensitive lookup

By itself, the MATCH function is not case-sensitive. However, you use the EXACT function with INDEX and MATCH to perform a lookup that respects upper and lower case, as shown below:

Case-sensitive lookup with INDEX and MATCH

Read a detailed explanation here.

Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.

Closest match

Another example that shows off the flexibility of INDEX and MATCH is the problem of finding the closest match. In the example below, we use the MIN function together with the ABS function to create a lookup value and a lookup array inside the MATCH function. Essentially, we use MATCH to find the smallest difference. Then we use INDEX to retrieve the associated trip from column B.

Find closest match with INDEX and MATCH

Read a detailed explanation here.

Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.

Multiple criteria lookup

One of the trickiest problems in Excel is a lookup based on multiple criteria. In other words, a lookup that matches on more than one column at the same time. In the example below, we are using INDEX and MATCH and boolean logic to match on 3 columns:  Item, Color, and Size:

INDEX and MATCH with multiple criteria

Read a detailed explanation here. You can use this same approach with XLOOKUP.

Note: this is an array formula and must be entered with control + shift + enter, except in Excel 365.

More examples of INDEX + MATCH

Here are some more basic examples of INDEX and MATCH in action, each with a detailed explanation:

  • Basic INDEX and MATCH exact (features Toy Story)
  • Basic INDEX and MATCH approximate (grades)
  • Two-way lookup with INDEX and MATCH (approximate match)

totn Excel Functions


This Excel tutorial explains how to use the Excel MATCH function with syntax and examples.

Description

The Microsoft Excel MATCH function searches for a value in an array and returns the relative position of that item.

The MATCH function is a built-in function in Excel that is categorized as a Lookup/Reference Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the MATCH function can be entered as part of a formula in a cell of a worksheet.

subscribe button Subscribe

If you want to follow along with this tutorial, download the example spreadsheet.

Download Example

Syntax

The syntax for the MATCH function in Microsoft Excel is:

MATCH( value, array, [match_type] )

Parameters or Arguments

value
The value to search for in the array.
array
A range of cells that contains the value that you are searching for.
match_type

Optional. It the type of match that the function will perform. The possible values are:

match_type Explanation
1 (default) The MATCH function will find the largest value that is less than or equal to value. You should be sure to sort your array in ascending order.

If the match_type parameter is omitted, it assumes a match_type of 1.

0 The MATCH function will find the first value that is equal to value. The array can be sorted in any order.
-1 The MATCH function will find the smallest value that is greater than or equal to value. You should be sure to sort your array in descending order.

Returns

The MATCH function returns a numeric value.
If the MATCH function does not find a match, it will return a #N/A error.

Note

  • The MATCH function does not distinguish between upper and lowercase when searching for a match.
  • If the match_type parameter is 0 and the value is a text value, then you can use wildcards in the value parameter.

    Wild card Explanation
    * matches any sequence of characters
    ? matches any single character

Applies To

  • Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • Worksheet function (WS)

Example (as Worksheet Function)

Let’s look at some Excel MATCH function examples and explore how to use the MATCH function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the Excel spreadsheet above, the following MATCH examples would return:

=MATCH(10574,A2:A6,0)
Result: 5     (it matches on 10574)

=MATCH(10572,A2:A6,1)
Result: 3     (it matches on 10571 since the match_type parameter is set to 1)

=MATCH(10572,A2:A6)
Result: 3     (it matches on 10571 since the match_type parameter has been omitted and will default to 1)

=MATCH(10572,A2:A6,0)
Result: #N/A  (it doesn't find a match since the match_type parameter is set to 0)

=MATCH(10573,A2:A6,1)
Result: 4

=MATCH(10573,A2:A6,0)
Result: 4

Let’s look at how we can use wild cards in the MATCH function.

Microsoft Excel

Based on the Excel spreadsheet above, the following MATCH examples would return:

=MATCH("A?ples", A2:A6, 0)
Result: 1

=MATCH("O*s", A2:A6, 0)
Result: 2

=MATCH("O?s", A2:A6, 0)
Result: #N/A

Frequently Asked Questions

Question: In Microsoft Excel, I tried this MATCH formula but it did not work:

=IF(MATCH(B94,Overview!D$54:D$96),"FS","Bulk")

I was hoping for an easier formula than this:

=IF(OR(B94=Overview!D$54,B94=Overview!D55,B94=Overview!D56,  {etc thru D96} ),"FS","Bulk")

Answer: When you are using the MATCH function, you need to be aware of a few things.

First, you need to consider whether your array is sorted in a particular order (ie: ascending order, descending order, or no order). Since we are looking for an exact match and we don’t know if the array is sorted, we want to make sure that the match_type parameter in the MATCH function is set to 0. This will find a match regardless of the sort order.

Second, we know that the MATCH function will return an #N/A error when a match is not found, so we will want to use the ISERROR function to check for the #N/A error.

So based on these 2 additional considerations, we would want to modify your original formula as follows:

=IF(ISERROR(MATCH(B94,Overview!D$54:D$96,0))=FALSE,"FS","Bulk")

This would check for an exact match in the D54:D96 array on the Overview sheet and return «FS» if a match is found. Otherwise, it would return «Bulk» if no match is found.


Question:I have a question about how to nest a MATCH function within the INDEX function. The question is:

I want to create a formula using the MATCH function nested within the INDEX function to retrieve the Class that was selected (by the x) in E4:F10. The MATCH function should find the row where the x is located and should be used within the INDEX function to retrieve the associated Class value from the same row within F4:F10.

Answer:We can use the MATCH function to find the row position in the range E4:E10 to find the row where «x» is located. We then embed this MATCH function within the INDEX function to return the corresponding value in the range F4:$10 as follow:

=INDEX($F$4:$F$10, MATCH("x",$E$4:$E$10))

In this example, we are searching for the value «x» within the range E4:E10. When the value of «x» is found, it will return the corresponding value from F4:F10.

MATCH in Excel

The MATCH function is a powerful tool in Excel that helps users search for a specific value within a range of cells and return its relative position. It’s a useful function for those who work with large datasets or need to locate specific values quickly. For instance, consider a situation where you have a long list of names, and you need to find the position of a particular name (John) within that list. You can use the MATCH function to search for the name and get its position (5).

MATCH in Excel

The utility of the MATCH function extends beyond simple searches within a range. For instance, one can use it in conjunction with other functions like INDEX and OFFSET to perform more complex operations.

Key Highlights

  • The MATCH function in Excel can perform both exact and approximate matches.
  • It can perform partial matches using wildcard operators such as * and ?.
  • The MATCH function returns a #N/A error if it does not find a match in the given array.
  • By using the MATCH and INDEX functions together, one can avoid using the VLOOKUP function to find a value at a matched position.
  • The Match type is an optional argument in the MATCH function, and if not specified, it defaults to 1.

Syntax of MATCH Function in Excel

The syntax of MATCH function is as follows:

1. Lookup_value (required): Indicates the value whose position we want to find in the selected range. A lookup value can be text, number, logical value, or cell reference.

2. Lookup_array (required): The cell range that contains the lookup value. Lookup array can be a row or a column.

3. Match_Type (optional): An optional argument with values 1, 0, and -1. The match_type argument, set to 0, returns an exact match, while the other two values allow for an approximate match.
a) Match_Type “1”: If the match type value is set as 1, Excel provides a value less than or equal to the lookup value.
b) Match_Type “0”: If the match type value is set as 0, Excel provides the first value that is equal to the lookup value.
c) Match_Type “-1”: If the match type value is set as 0, Excel provides the smallest value that is greater than or equal to the lookup value.

Types of MATCH Function in Excel

You can download this MATCH Function Excel Template here – MATCH Function Excel Template

Here are the different types of MATCH functions in Excel:

#1 Exact MATCH

The MATCH function performs an exact match when the match type is set to zero. In the below-given example, the formula in E3 is:

=MATCH(E2,B3:B10,0)

Exact

Here, the MATCH Function returns the Exact match as 4.

MATCH Exact match 1-1

#2 Approximate MATCH

MATCH will perform an approximate match on values sorted A-Z when the match type is set to 1, finding the largest value less than or equal to the lookup value. In the below-given example, the formula in E3 is:

Approximate

The MATCH in Excel returns an approximate match as 7.

MATCH Approximate match -1

#3 Wildcard MATCH

MATCH function can perform a match using wildcards when the match type is set to zero. In the below-given example, the formula in E3 is:

Wildcard

The MATCH function returns the result of wildcards as “pq”.

MATCH wildcard match -1

Points to Note:

  • A MATCH Function is not case-sensitive.
  • MATCH returns the #N/A error if there is no match is found.
  • The argument lookup_array must be in descending order: True, False, Z-A,…9,8,7,6,5,4,3,…, and so on. However, if match_type is set to 1 or omitted, the lookup_array must be sorted in ascending order.
  • The wildcard characters like an asterisk () and question mark (?) can be used in the lookup_value argument if match_type is set to 0 and lookup_value is in text format, regardless of whether the lookup_value contains these characters. The asterisk () matches any sequence of characters, while the question mark (?) matches any single character.

How to Use MATCH Function in Excel?

Example #1 Finding The Exact Match

The table below shows a list of ordered products with their order ID, unit price, and sales quantity. We want to find the position of “Deodorant” in the table using the MATCH function in Excel.

Finding The Exact Match

Solution:

Step 1: Select the cell where you want to display the position of the product “Deodorant“. In this case, let’s assume it is cell B12.

Step 2: Type the MATCH function in the formula bar: =MATCH(B12,B6:B10,0)

  • The first argument in the formula is the lookup value, which is “Deodorant“, i.e., cell B12.
  • The second argument of the MATCH function is the lookup array, which is the range B6:B10. This range contains the products listed in the table.

Note: The lookup_array can be a row or a column.

  • The third argument of the MATCH function is the match type, which is 0. This means we want to find an exact match of the lookup value in the array.

lookup value in the array

Step 3: Press Enter to get the result, as shown below.

result

The formula returns the position of “Deodorant” in the table, which is 2. This means that “Deodorant” is the second product listed in the table.

Explanation of the Formula:

When you press the Enter key, Excel searches through the cells in the lookup array “B6:B10” to find an exact match for the lookup value “Deodorant”. After finding the match, it returns the position of the first cell containing the lookup value. In this scenario, the formula returns the value “2“, indicating that the first cell containing “Deodorant” is the second cell in the range B6:B10.

Example #2 Finding Partial MATCH using Wildcard Character

Let’s say we have a list of cities in Column A, and we want to find the position of the city that starts with “New” in the list.
Here’s how we can do it:

Step 1: Open a new Excel spreadsheet and enter the list of cities in Column A.

Finding Partial Match using Wildcard Character

Step 2: In an empty cell, enter the formula =MATCH(“New*”,A6:A10,0).

Explanation of the Formula:
  • “New*”: This is the search criteria. The asterisk () is a wildcard character representing any number of characters. So, “New” will match any city name that starts with “New”.
  • A6:A10: This is the range of cells we want to search for our city name in.
  • 0: This is the match_type argument. Here, we’re using an exact match, so we specify 0.

step 2

Step 3: Press the “Enter” key to display the result in the cell where you entered the formula.

step 3

The result is “1,” which is the position of the first city that starts with “New”. In this case, “New York” is the first city that starts with “New” in the list.

Note: If multiple cities match the search criteria, the MATCH function will only return the position of the first occurrence.

Example #3 Using INDEX and MATCH Function Together

The table below shows a list of students with their marks in the subjects – Language, Maths, History, and Physics. Using the INDEX and MATCH functions together, we want to find Alex’s marks in History

Using INDEX and MATCH Function Together

Solution:
Step 1: Select the cell where you want to display the result. In this case, it is cell B15.
Step 2: Enter the formula in the cell:

=INDEX(A5:E12,MATCH(B14,A5:A12,0),MATCH(A15,A5:E5,0))

  • A5:E12: This is the range of cells containing the table of student data.
  • B14: This is the value we want to find in the first column of the table, which is the name of the student whose marks we want to find (in this case, “Alex”).
  • A5:A12: This is the range of cells containing the students’ names in the table’s first column.
  • 0: This argument specifies that we want an exact match.
  • A15: This is the value we’re looking for in row 5, which is the subject “History”.
  • A5:E5: This is the cell range containing the subject names.

Using INDEX and MATCH Function Together 2

Step 3: Press Enter key to get the below result.

Using INDEX and MATCH Function Together 3

The INDEX and MATCH functions of Excel work together to provide the result of 51, which denote History marks of Alex.

Explanation of the Formula:
  • The first MATCH function in the formula =INDEX(A5:E12,MATCH(B14,A5:A12,0),MATCH(A15,A5:E5,0)) searches for the student name “Alex” in the range A5:A12 and returns the relative position of that name within the range. The third argument of the MATCH function is 0, which specifies that we want an exact match. In this case, “Alex” is in the third row of the range, so the first MATCH function returns the value 3.
  • The second MATCH function in the formula searches for the subject “History” in the range A5:E5 and returns the relative position of that subject within the range. Again, the third argument of the MATCH function is 0, which specifies that we want an exact match. In this case, “History” is in the third column of the range, so the second MATCH function returns the value 3.
  • The INDEX function then uses these two values (3 and 3) to return the corresponding value in the table, which is the marks that Alex scored in History (51).

Example #4 When a Cell contains One of Many Things

Generic formula: {=INDEX(results,MATCH(TRUE,ISNUMBER(SEARCH(things,A1)),0))}

Explanation: The INDEX / MATCH function formed on the SEARCH function can be used to check a cell for one of many things and give back a custom result for the first match found.
In the example shown below, the formula in cell C5 is:
{=INDEX(results,MATCH(TRUE,ISNUMBER(SEARCH(things,B5)),0))}
Since the above is an array formula, it should be entered using Control + Shift + Enter keys.

Example-4

Explanation of the Formula:
  • This formula uses two named ranges: E5:E8 is named “things”, and F5:F8 is named “results”.
  • Ensure using the name ranges with the same names (depending on the data). If one doesn’t want to use named ranges, use absolute references instead.
  • The main part of this formula is the below snippet:

ISNUMBER(SEARCH(things, B5)

  • This is based on another formula that checks a cell for a single substring. If the cell has the substring, the formula gives TRUE; if not, the formula gives FALSE

Example #5 Lookup using the Lowest Value

Generic formula =INDEX(range,MATCH(MIN(vals),vals,0))

Explanation: To lookup information associated with the lowest value in a table, one can use a formula depending on MATCH, INDEX, and MIN functions.
In the below example, a formula is used to find the name of the contractor who has the lowest bid. The formula in F6 is:
=INDEX(B5:B9,MATCH(MIN(C5:C9),C5:C9,0)))

Example-5

Explanation of the Formula:
  • Working from the inside out, the MIN function is generally used to find the lowest bid in the range C5:C9:
  • The result, 99500, is fed into the MATCH function as the lookup value:
  • MATCH then gives back the position of this value in the range, 4, which goes into INDEX as the row number and B5:B9 as the array:

=INDEX(B5:B9, 4) // returns Cymbal

  • The INDEX function then gives back the value at that position: Cymbal.

Match Function Errors

If you get an error from the Match function, this is likely to be the #N/A error:

Error 1

Also, some users experience the following common problem with the Match Function:

Error 2

Things to Remember

  • MATCH types: One can use three match types with the MATCH function: 0, 1, and -1. The default match type is 0, which finds an exact match. Match type 1 finds the largest value that is less than or equal to the lookup_value, while match type -1 finds the smallest value that is greater than or equal to the lookup_value.
  • Array size: The lookup_array argument must be a one-dimensional array or a reference to a one-dimensional range of cells. If the lookup_array is not one-dimensional, the MATCH function will return a #N/A error.
  • Sorted order: If the values in the lookup_array are not sorted in ascending order, the MATCH function in Excel may return an incorrect result. In such cases, use the match_type argument to specify the appropriate match type.
  • Exact MATCH: If the MATCH function does not find the lookup_value in the lookup_array, it will return a #N/A error. You can use the IFERROR function to handle this error and return a more meaningful result.
  • Relative or absolute cell reference: The MATCH function is compatible with both relative and absolute cell references. When copying the formula to other cells, the function will adjust the cell references accordingly.

Frequently Asked Questions (FAQs)

Q1. What is an example of a MATCH function in Excel?

Answer: The MATCH function searches for a given value in a data set and provides the position of that value in the range. For instance, suppose you have a data set that includes items like Spinach, Brinjal, Tomato, French Bean, and Cabbage in the range B6:B10. If you want to find the position of the value “French Bean” in the range, you can use the MATCH function.
The formula =MATCH(B12,B6:B10,0) returns the “French Bean” position in the range B6:B10 as the number 4.

example of a MATCH function in Excel

Q2. What is the benefit of including the MATCH function within an INDEX function?

Answer: Including the MATCH function within an INDEX function allows you to retrieve data dynamically based on specific search criteria.
Suppose you have a list of fruits and their prices in a table. You want to retrieve the price of a specific fruit, say “Apple”, from the table. One way to do this is to search the table for the row containing “Apple” manually, and then look for the price in the corresponding column. However, if you have a large dataset with many rows and columns, this can be a time-consuming and error-prone process. Instead, you can use the MATCH function to find the row number of “Apple” in the table and then use the INDEX function to retrieve the price from the corresponding column. The formula would look like this:

=INDEX(B2:E6,MATCH(“Apple”,A2:A6,0),3)

The MATCH function searches for “Apple” in the table’s first column (A2:A6) and returns the row number where it is found. The INDEX function then retrieves the value from the table’s third column (price column) at the intersection of the row and column numbers that the MATCH function returns.

Q3. Can the MATCH function have multiple criteria?

Answer: It is possible to use the MATCH function with multiple criteria by combining it with other functions such as INDEX, SUMPRODUCT, and COUNTIFS. For instance, consider this formula:

= MATCH(1, (B2:B10=”Sales”) * (C2:C10>20000), 0) + COUNTIFS(B2:B10, “Sales”, C2:C10, “>20000”)

This formula uses MATCH with multiple criteria to find the position of the first employee in the “Sales” department who earns more than $20,000 per year. Then, it adds the count of cells that satisfy only the second condition using the COUNTIFS function.

Q4. What is the difference between MATCH and VLOOKUP in Excel?

Answer: The MATCH function helps us find the location of a particular value in a column or row, while the VLOOKUP function helps us retrieve information associated with that value.
For instance, if we want to find the price of oranges in the following table, we will have to use the MATCH function in conjunction with the INDEX function to find the price. Alternatively, the VLOOKUP function can directly provide the price of oranges at $0.75.

Product

Price

Apples $1.00
Oranges $0.75
Bananas $0.50

The formula for using MATCH and INDEX functions together is =INDEX(B:B, MATCH(“Oranges”, A:A, 0)). Using MATCH, this formula finds the position of “Oranges” in column A, which returns the value 2. Then, INDEX retrieves the value in column B’s corresponding row, i.e., $0.75.

  • The VLOOKUP function formula is =VLOOKUP(“Oranges”, A:B, 2, 0). This formula looks for “Oranges” in the first column of the range A:B, and returns the corresponding value from the second column (i.e., the price column), resulting in $0.75.

Recommended Articles

The above article is our guide to using the MATCH function in Excel. Here are some further examples of expanding understanding:

  1. Excel Match Multiple Criteria
  2. How to Match Data in Excel
  3. Matching Columns in Excel
  4. Compare Two Columns in Excel for Matches

In this article, we will learn How to use the MATCH function in Excel.

Why do we use the MATCH function ?

Given a table of 500 rows and 50 columns and we need to get a row index value at 455th row and 26th column. For this either we can scroll down to the 455th row and traverse to the 26th column and copy the value. But we can’t treat Excel like hard copies. MATCH function returns the INDEX at a given row and column value in a table array. Let’s learn the MATCH function Syntax and illustrate how to use the function in Excel below.

MATCH Function in Excel

The MATCH function in excel just returns the index of first appearance of a value in an array (single dimension). This function is mostly associated with the INDEX function, often known as the INDEX-MATCH function.

Syntax of MATCH Function:

=MATCH(lookup value, lookup array, match type)

lookup value : The value you are looking for in the array.

lookup array : The arrays in which you are looking for a value

Match Type : The match type. 0 for exact match, 1 for less than and -1 for greater than.

Example :

All of these might be confusing to understand. Let’s understand how to use the function using an example.

Here In the above image, we have a table. In cell H1, we have our task returning Index number of first appearance of Gill and Kivell.

In cell I2, write this formula and drag it down to I3.

We have our index numbers.

Now you can use this index number with INDEX function of excel to retrieve data from tables.

If you don’t know how to use INDEX MATCH function to retrieve data, below article will be helpful for you.

How to Use Index with Match Function in Microsoft Excel 2010

Do you know how to use the MATCH formula with VLOOKUP to automate reports? In Next article we will learn the use of VLOOKUP MATCH formula. Till then, Keep Practicing — Keep Excelling.

Use of INDEX & MATCH function to lookup value

Here we have a list of scores gained by students with their Subject list. We need to find the Score for a specific Student (Gary) & Subject (Social Studies) as shown in the snapshot below.

The Student value1 must match the Row_header array and Subject value2 must match the Column_header array.

Use the formula in the J6 cell:

Explanation:

  • The MATCH function matches the Student value in J4 cell with the row header array and returns its position 3 as a number.
  • The MATCH function matches the Subject value in J5 cell with the column header array and returns its position 4 as a number.
  • The INDEX function takes the row and column index number and looks up in the table data and returns the matched value.
  • The MATCH type argument is fixed to 0. As the formula will extract the exact match.

Here values to the formula is given as cell references and row_header, table and column_header given as named ranges.

As you can see in the above snapshot, we got the Score obtained by student Gary in Subject Social Studies as 36 .  And it proves the formula works fine and for doubts see the below notes for understanding.

Now we will use the approximate match with row headers and column headers as numbers. Approx match only takes the number values as there is no way it applies on text values

Here we have a price of values as per the Height & Width of the product. We need to find the Price for a specific Height (34) & Width (21) as shown in the snapshot below.

The Height value1 must match the Row_header array and Width value2 must match the Column_header array.

Use the formula in the K6 cell:

Explanation:

  • The MATCH function matches the Height value in K4 cell with the row header array and returns its position 3 as a number.
  • The MATCH function matches the Width value in K5 cell with the column header array and returns its position 2 as a number.
  • The INDEX function takes the row and column index number and looks up in the table data and returns the matched value.
  • The MATCH type argument is fixed to 1. As the formula will extract the approximate match.

Here values to the formula is given as cell references and row_header, data and column_header given as named ranges as mentioned in the snapshot above.

As you can see in the above snapshot, we got the Price obtained by height (34) & Width (21) as 53.10 .  And it proves the formula works fine and for doubts see the below notes for more understanding.

You can also perform lookup exact matches using INDEX and MATCH function in Excel. Learn more about How to do Case Sensitive Lookup using INDEX & MATCH function in Excel. You can also look up for the partial matches using the wildcards in Excel.

Notes: 

  1. The function returns the #NA error if the lookup array argument to the MATCH function is 2 D array which is the header field of the data..
  2. The function matches the exact value as the match type argument to the MATCH function is 0.
  3. The lookup values can be given as cell reference or directly using quote symbol ( » ) in the formula as arguments.

Hope this article about How to use the MATCH function in Excel is explanatory. Find more articles on finding values and related Excel formulas here. If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write to us at info@exceltip.com.

Related Articles :

Use INDEX and MATCH to Lookup Value : The INDEX & MATCH formula is used to lookup dynamically and precisely a value in a given table. This is an alternative to the VLOOKUP function and it overcomes the shortcomings of the VLOOKUP function.

Use VLOOKUP from Two or More Lookup Tables : To lookup from multiple tables we can take an IFERROR approach. To lookup from multiple tables, it takes the error as a switch for the next table. Another method can be an If approach.

How to do Case Sensitive Lookup in Excel : The excel’s VLOOKUP function isn’t case sensitive and it will return the first matched value from the list. INDEX-MATCH is no exception but it can be modified to make it case sensitive.

Lookup Frequently Appearing Text with Criteria in Excel : The lookup most frequently appears in text in a range we use the INDEX-MATCH with MODE function.

Popular Articles :

How to use the IF Function in Excel : The IF statement in Excel checks the condition and returns a specific value if the condition is TRUE or returns another specific value if FALSE.

How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.

How to use the COUNTIF Function in Excel : Count values with conditions using this amazing function. You don’t need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

Like this post? Please share to your friends:
  • Use many if excel
  • Use mail in a sentence for each word
  • Use lot of in a sentence for each word
  • Use lost in a sentence for each word
  • Use little in a sentence for each word