How to Use Excel MATCH Function? 3 Use Cases
(Note: This guide on how to use Excel MATCH function is suitable for all Excel versions including Office 365)
Excel consists of a variety of functions that help in performing a variety of operations at ease.
When there is a lot of data in Excel, using Excel tables and PivotTables might be a good way to format and handle the data. Suppose you want to find the position of a particular value in the table. What will you do? You can use the Excel MATCH function to find the position of the particular value.
In this article, I will tell you how to use Excel MATCH function along with the 3 use cases.
You’ll Learn:
Related Reads:
How to Use CONVERT Function in Excel? A Step-by-Step Guide
How to Use the Excel TREND Function? A Step-by-Step Guide
How to Use SUMPRODUCT Function in Excel? 5 Easy Examples
What is Excel MATCH Function?
The MATCH function can be found under Excel’s Lookup & Reference Function. The main purpose of the MATCH function is that this function is used to search for any data in an array of cells and returns the relative position of that particular data.
Though this function is similar to the VLOOKUP function, the Excel MATCH function is predominantly used when you have to search for and return the position of the data rather than the original data itself.
The MATCH function not only returns the position of the exact match of the value but can also return the approximate and wildcard matches.
Syntax
The syntax of the MATCH function takes three arguments.
=MATCH(lookup_value, lookup_array, [match_type])
Where,
lookup_value is a mandatory field. This value can either be a number, text, or a variable like a cell reference which represents the particular value. This argument denotes the value which you want to search in the array. Using this argument, you can find a particular value or another value corresponding to the field.
lookup_array is also a mandatory field. This denotes the data array or the cell range from which you want the function to look for the lookup_value.
match_type is an optional field and can take only the values -1,0, and 1. This field defines how you want the function to search the lookup_value in the lookup_array.
The three values in the match_type argument have three different meanings:
- When the match_type value is -1, the function finds the exact or smallest value greater than or equal to the lookup_value. However, when using this match_type, make sure the array is sorted in descending order.
- When the match_type argument is 0, the MATCH function searches for and finds the first value equal to the lookup_value.
- When the match_type value is 1, the MATCH function finds the exact or largest value lesser than or equal to the lookup_value. However, the values in the lookup_array must be arranged in ascending order. Since this is an optional field, the default value will be 1 even if you mention it in the formula or not.
How to Use Excel MATCH Function?
Consider an example, where you have a list of 12 colors ranging from cells A6 to A17 along with their sample color codes.
Now when you use the MATCH function, Excel returns the position of the value you have searched for, i.e. lookup_value. You can use the MATCH function in 3 different ways.
Let us see how.
Find the Exact Match Using match_type 0
When the match_type is 0, the MATCH function returns the position of the exact value in the first occurrence in the array.
From the above example, consider that you want to find the position of the value “Brown” in the table. But, you know the value of the Sample Code for the color “Brown”.
- To find the exact match for the particular value, first, choose a destination cell.
- Enter the formula =MATCH(30,B6:B17,0). Where 30 is the sample code for the color Brown, B6:B17 is the array in which you want to search for, and 0 represents that you want to search for the exact value from the array.
- Press Enter.
- This gives you the position of the searched sample code.
The value returned is 4. This means that the color code 30 and the corresponding value Brown is in the 4th position in the table.
Note: If the value you entered with the match_type 0 is nowhere to be found in the table, the function returns a #N/A error.
Suggested Reads:
How to Use the PROPER Function in Excel? 3 Easy Examples
How to Graph a Function in Excel? 2 Easy Ways
How to Use the ROUND Function in Excel?
Find an Approximate Match Using match_type 1
When the match_type is 1, the MATCH function returns the position of the first occurrence of the exact or largest value close to the lookup_value.
From the above example, let us imagine you want to find the position of a certain color from the table. But, you only remember the closest sample color code which corresponds to the color and not the exact value.
- Since we will be using match_type 1, make sure to sort the values in ascending order.
- To find the position of the value, first, choose a destination cell.
- Enter the formula =MATCH(40,B6:B17) in the destination cell. Where 40 is the value to search for and B6:B17 is the array through which you want to search for the value. If you leave the match_type argument empty, the default value will be 1.
- Press Enter.
- This gives you the required value in the destination cell.
You can see that since there is no exact value corresponding to 40, the MATCH function returns the largest value less than or equal to the particular value i.e. 38.
Find the Approximate Match Using match_type -1
When you pass the match _type argument as -1, the MATCH function returns the position of the first occurrence of the exact or smallest value close to the lookup_value.
Consider the above example from which you want to find the position of a certain color. But, you only remember the approximate Sample Code and you want to find the smallest value closer to the lookup_value.
- Before using the match_type -1 always remember to sort the lookup_array in descending order. Else, the function returns an #N/A error.
- To use the function, select a destination cell.
- Enter the formula =MATCH(40,B6:B17,-1) in the destination cell. Where 40 is the lookup_value and B6:B17 is the array range in which you want to search the value. And, -1 is the match_type value.
- Press Enter.
This gives you the required value (42) in the destination cell. Since the match_type is -1, it can be seen that the MATCH function returns the smallest value greater than or equal to lookup_value 40.
Points to Remember
- The MATCH function is not case-sensitive. It does not distinguish between uppercase and lowercase characters when matching text values i.e. entering “brown” or “BROWN” renders the same meaning.
- When the MATCH function could not find the lookup_value in the array, it returns an #NA error.
- You can also use wildcards like ? and * to search for the text values. You can use the question mark (?) character to search for any single character or use the asterisk (*) character to match a sequence of characters. To search for the “?” or “*” characters, you can use the tilde (~) character before the character.
Also Read:
How to Use the Excel IFS Function? – 2 Easy Examples
How to Use the TEXTJOIN Excel Function? 3 Easy Examples
How to Use the Excel DATEDIF Function? 3 Easy Examples
Frequently Asked Questions
Can we search for text strings using the MATCH function?
Yes, you can search for text strings. In the lookup_value argument, enter the text you want to search for in double quotes and press Enter.
What is the purpose of the match_type argument in the MATCH function in Excel?
The match_type argument specifies the way you want the search to occur. This argument only takes either of the three characters. When the match_type is 0, the function returns the position of the exact value. When the match_type is 1, the function returns the position of the first occurrence of the exact or largest value close to the lookup_value. When the match_type is -1, the function returns the position of the first occurrence of the exact or smallest value greater than the lookup_value.
What is the difference between VLOOKUP and MATCH functions?
The MATCH function in Excel is similar to the VLOOKUP function. The VLOOKUP function is used to search for a particular value in a table. Whereas, the Excel MATCH function is predominantly used when you have to search for and return the position of the data rather than the original data itself.
Closing Thoughts
The MATCH function can be a very helpful tool that helps you find the relative position of the value. This can help find, replace, or make any changes to the data.
In this article, we saw how to use Excel MATCH function. We also saw the syntax along with different scenarios to use the MATCH function in Excel.
If you need more high-quality Excel guides, please check out our free Excel resources center. Simon Sez IT has been teaching Excel for over ten years. For a low, monthly fee you can get access to 140+ IT training courses. Click here for advanced Excel courses with in-depth training modules.