The MATCH function in Excel is used to locate the relative position of a specific item in a range of cells. Unlike VLOOKUP or XLOOKUP, which return the value of a cell, MATCH returns a number representing the row or column index where the item is found. For example, if you search for "Apple" in a list of fruits and "Apple" is the third item down, MATCH will return the number 3. This is essential for creating dynamic lookups and flexible spreadsheets where data positions might change.
What You'll Need
- A computer with Microsoft Excel installed (all versions support MATCH).
- A dataset containing a list of values (a single row or a single column).
- A specific value (lookup value) that you want to find within that list.
Step-by-Step
- Identify your data range: Determine which column or row contains the data you want to search. The MATCH function only works on a one-dimensional range; it cannot search a multi-column table at once. For example, if your list of employee names is in cells A2 through A10, your lookup array is A2:A10.
- Select the output cell: Click on the cell where you want the position number to appear.
- Start the formula: Type
=MATCH(into the cell. This opens the function arguments. - Enter the Lookup Value: This is the item you are searching for. You can type the value directly in quotes (e.g.,
"Apple") or click on a cell that contains the value (e.g.,C2). After entering this, type a comma. - Define the Lookup Array: Highlight the range of cells where the value exists. For example, click and drag from A2 to A10. Your formula should now look like
=MATCH(C2, A2:A10,. Type another comma. - Specify the Match Type: This is the most critical part of the formula. You must enter a number to tell Excel how strictly to search:
- 0: Exact Match. This finds the first value that is exactly equal to the lookup value. This is the most common choice.
- 1: Less Than. Finds the largest value that is less than or equal to the lookup value. This requires the list to be sorted in ascending order.
- -1: Greater Than. Finds the smallest value that is greater than or equal to the lookup value. This requires the list to be sorted in descending order.
- Close and Execute: Type the closing parenthesis
)and press Enter. If the value is found, Excel will display the position number. If it is not found, it will display a #N/A error.
Common Mistakes
One of the most frequent errors is omitting the match type. If you leave the third argument blank, Excel defaults to 1 (Less Than). If your data is not sorted in ascending order, Excel will return an incorrect position or an error, even if the exact value exists in the list. Always use 0 for exact matches unless you are specifically working with sorted numerical ranges.
Another common mistake is selecting a two-dimensional range. If you select A2:B10 instead of A2:A10, the MATCH function will return a #VALUE! error because it is designed to search only a single row or a single column. Ensure your selection is a narrow strip of data.
Users also often confuse the result of MATCH with the cell address. Remember that MATCH does not tell you the cell is "A3"; it tells you the item is in the 3rd position of the range you selected. If your range starts at A10 and the item is in A12, MATCH will return 3, not 12.
Tips
To make your MATCH function more powerful, combine it with the INDEX function. While MATCH finds the position, INDEX retrieves the value from a different range based on that position. This combination (INDEX-MATCH) is a professional alternative to VLOOKUP because it allows you to look up values to the left of your search column, which VLOOKUP cannot do.
Use absolute references (dollar signs) for your lookup array if you plan to drag the formula down a column. For example, instead of A2:A10, use $A$2:$A$10. This prevents the search range from shifting downward as you copy the formula to other cells, ensuring every search looks at the same master list.
If you are searching for text that might have accidental trailing or leading spaces, wrap your lookup value in the TRIM function. For example: =MATCH(TRIM(C2), A2:A10, 0). This removes invisible spaces that would otherwise cause an exact match search to fail.
Troubleshooting
If your formula is not working as expected, follow these steps in order:
Check for #N/A errors: This is the most common result. It simply means Excel cannot find the value. First, check for typos in your lookup value. Second, check for hidden spaces in your data range. Third, ensure that the data types match; if you are searching for the number 100, but the cell is formatted as text, Excel will not see them as the same value.
Check for #VALUE! errors: This usually happens when the lookup array is not a single row or column. Re-select your range to ensure you haven't accidentally highlighted two columns or two rows.
Verify the Match Type: If you are getting a number that seems wrong, check your third argument. If you used 1 or -1 instead of 0, Excel is providing an approximate match. Change the 0 to ensure you are getting the exact location of the item.
Update Range References: If you have added new data to the bottom of your list, your range (e.g., A2:A10) might be too short. Update the range to include the new rows or convert your data range into an official Excel Table (Ctrl+T), which allows the MATCH range to expand automatically as you add data.
Frequently Asked Questions
Can MATCH search for partial text?
Yes, by using wildcards. You can use an asterisk (*) to represent any number of characters. For example, =MATCH("*Apple*", A2:A10, 0) will find the position of any cell that contains the word "Apple" anywhere in the text.
Is MATCH case-sensitive?
No, the standard MATCH function is not case-sensitive. Searching for "APPLE", "apple", or "Apple" will all return the same position result.
What is the difference between MATCH and VLOOKUP?
VLOOKUP returns the value of a cell in a different column based on a match. MATCH only returns the row or column number where the match was found. MATCH is a "position finder," while VLOOKUP is a "value retriever."
Can I use MATCH to find a column number?
Yes. While most people use it for vertical lists (columns), you can select a horizontal range (a row). For example, =MATCH("January", A1:M1, 0) will return the column number where "January" is located in the header row.
Why does MATCH return a different number than the row number in Excel?
MATCH returns the relative position within the selected range. If your range starts at row 5 and the match is found in row 7, MATCH returns 3 because row 7 is the third cell in that specific range, not the 7th row of the entire spreadsheet.