The LOOKUP function in Excel is a versatile tool that allows users to retrieve values from a vector or array based on a specified criterion. It simplifies the process of searching for data by automatically returning the corresponding value in another range, thus enhancing data analysis and reporting efficiency.
Syntax
LOOKUP(lookup_value, lookup_vector, [result_vector])
- lookup_value: The value to search for within the lookup_vector.
- lookup_vector: The range of cells or array where the function searches for the lookup_value.
- [result_vector]: (Optional) The range of cells or array from which to return a value. If omitted, LOOKUP will return values from the lookup_vector.
Example #1
LOOKUP(10, A1:A5, B1:B5)
This function searches for the value 10 in the range A1:A5 and returns the corresponding value from B1:B5. If the value is found, the result could be, for example, “Apples” if that is the corresponding entry.
Example #2
LOOKUP(5, {1, 2, 3, 4, 5}, {10, 20, 30, 40, 50})
In this case, the function looks for 5 within the array of values {1, 2, 3, 4, 5} and returns 50 from the results array {10, 20, 30, 40, 50} as it aligns with the last occurrence of that value.
Example #3
LOOKUP("D", {"A", "B", "C", "D"}, {1, 2, 3, 4})
This command searches for the letter D in the provided array and outputs the corresponding number 4 from the result array.
Error handling
- N/A: This error occurs when the lookup_value is not found in the lookup_vector. Ensure the value exists before applying the function.
- VALUE!: This error indicates a problem with the data types used. Make sure all values in the lookup_vector are of compatible types.
- REF!: This means that a referenced cell in the result_vector is not valid, typically because it has been deleted or is out of range.