How do you use Excel’s LOOKUP function
The LOOKUP function in Excel is used to search for a value in a range (one row or column) and return a corresponding value from another range. It is often used to retrieve data based on a lookup value. Here’s how to use it:
Syntax
LOOKUP(lookup_value, lookup_vector, [result_vector])
lookup_value: The value you want to search for. This can be a number, text, or reference to a cell containing the search value.lookup_vector: A single row or column range where Excel will search for thelookup_value.result_vector(optional): A single row or column range that corresponds to thelookup_vector. Excel will return the value from this range that corresponds to the position of thelookup_valuefound in thelookup_vector.
If you omit the result_vector, LOOKUP will return a value from the lookup_vector itself.
Example
Let’s say you have the following data:
| A | B |
|---|---|
| Apple | 10 |
| Banana | 20 |
| Cherry | 30 |
| Date | 40 |
You want to find the price for "Cherry." Here’s how to use LOOKUP:
excel
Copy code
=LOOKUP("Cherry", A1:A4, B1:B4)
lookup_value:"Cherry"lookup_vector:A1:A4(the list of fruits)result_vector:B1:B4(the list of prices)
This will return 30 because "Cherry" is in the third position of column A, and the corresponding value in column B is 30.
Notes:
- The
lookup_vectormust be sorted in ascending order, orLOOKUPmay not work as expected. - If an exact match for
lookup_valueis not found,LOOKUPwill match the largest value in thelookup_vectorthat is less than or equal tolookup_value.