The `LOOKUP` function in Excel is used to search for a value in a range and return a corresponding value. The two syntax forms are:
\vspace{0.3cm}
1. Vector Form:
- Syntax:
\[
=\text{LOOKUP(lookup\_value, lookup\_vector, result\_vector)}
\]
- Explanation:
- Searches for a value (lookup value) in a single row or column (`lookup vector`) and returns the corresponding value from another row or column (`result vector`).
- Example:
If you have product codes and prices,
\[
\text{Product Code: A101, B202, C303; Prices: 500, 700, 900.}
\]
To find the price of `B202`, use:
\[
=\text{LOOKUP("B202", A2:A4, B2:B4)}
\]
Result: 700
\vspace{0.5cm}
2. Array Form:
- Syntax:
\[
=\text{LOOKUP(lookup\_value, array)}
\]
- Explanation:
- Searches for a value (`lookup value`) in a two-dimensional array and returns the corresponding value.
- Example:
For student names and grades:
\[
\text{Names: John, Sarah, Mike; Grades: A, B, A+.}
\]
To find the grade of "Sarah," use:
\[
=\text{LOOKUP("Sarah", A2:A4, B2:B4)}
\]
Result: B
\vspace{0.5cm}