The MATCH function in Excel is a powerful tool used to find the position of a specified value within a given range or array. This function helps users locate items in a dataset, facilitating data analysis and effective decision-making. Whether dealing with numerical data, text, or logical values, MATCH provides a seamless way to enhance data retrieval processes.
Syntax
MATCH(lookup_value, lookup_array, [match_type])
- lookup_value: The value that you want to find in the lookup_array.
- lookup_array: The range or array to search for the lookup_value.
- [match_type]: An optional argument that specifies how to match the lookup_value with the values in lookup_array. It can take the following values:
- 0: Exact match
- 1: Less than (values must be sorted in ascending order)
- -1: Greater than (values must be sorted in descending order)
Example #1
MATCH("Banana", A1:A5, 0)
This function searches for “Banana” in the range A1:A5. If “Banana” is found in A3, it will return a result of 3 as the position within the specified range.
Example #2
MATCH(25, B1:B10, 1)
This example looks for the value 25 in the range B1:B10, assuming that the values are sorted in ascending order. If 25 is found in B5, it outputs 5 as the position.
Example #3
MATCH(TRUE, C1:C10, 0)
In this case, it searches for the first occurrence of TRUE in the range C1:C10. If the first TRUE is in C2, the result would be 2 as its position.
Error handling
- N/A: This error indicates that the lookup_value could not be found in the lookup_array.
- VALUE!: This occurs if the provided match_type is not valid. It needs to be either 0, 1, or -1.