DEV Community

Azad Kshitij
Azad Kshitij

Posted on

Lookup in 1 min

This is a handy function when you need to look up something quickly and easily.

LOOKUP has two forms: vector and array. The vector form is simpler and more common, so I'll focus on that one. The vector form of LOOKUP has three arguments:

  • lookup_value: This is the value that you want to find in a row or column. It can be a number, text, a logical value, or a reference to a cell.
  • lookup_vector: This is the range that contains the values that you want to match with lookup_value. It can be a row or a column, but it must be sorted in ascending order.
  • result_vector: This is the range that contains the values that you want to return from the same position as lookup_value. It can be a row or a column, but it must be the same size as lookup_vector.

For example, let's say you have a table of products and prices like this:

Product Price
Apple $1
Banana $2
Cherry $3
Date $4
Eggplant $5

If you want to find the price of a product, you can use LOOKUP like this:

=LOOKUP("Cherry",A2:A6,B2:B6)

This formula will return $3, because "Cherry" is in cell A4, and $3 is in cell B4.

You can also use LOOKUP to find the product name for a given price, like this:

=LOOKUP(4,A2:B6,A2:A6)

This formula will return "Date", because 4 is in cell B5, and "Date" is in cell A5.

That's it for this blog post. I hope you learned something new about LOOKUP in Excel. If you have any questions or comments, feel free to leave them below. Thanks for reading!

Top comments (0)