Chapter 4: Lookup Functions
Chapter 4: Lookup Functions
Objectives:
In the VLOOKUP and HLOOKUP functions, range lookup is optional. If this is omitted or set
as True, then the first column of the table must be sorted in ascending numerical order.
If an exact match for the lookup_value is found in the first column, then Excel will return the
value the col_index_num of that row. If an exact match is not found, Excel will choose the row
with the largest value in the first column that is less than the lookup_value.
If range lookup is False, then Excel seeks an exact match in the first column of the table range.
If no exact match is found, Excel will return #N/A (not available).
We recommend that you specify the range lookup to avoid errors.
VLOOKUP FUNCTION
The VLOOKUP function below looks up the value 53 (first argument) in the leftmost column of
the red table (second argument).
The value 4 (third argument) tells the VLOOKUP function to return the value in the same row
from the fourth column of the red table.
Note: the Boolean FALSE (fourth argument) tells the VLOOKUP function to return an exact
match. If the VLOOKUP function cannot find the value 53 in the first column, it will return a #N/A
error.
Here's another example. Instead of returning the salary, the VLOOKUP function below returns
the last name (third argument is set to 3) of ID 79.
Approximate Match
The VLOOKUP function below looks up the value 85 (first argument) in the leftmost column of
the red table (second argument). There's just one problem. There's no value 85 in the first
column.
Fortunately, the Boolean TRUE (fourth argument) tells the VLOOKUP function to return an
approximate match. If the VLOOKUP function cannot find the value 85 in the first column, it will
return the largest value smaller than 85. In this example, this will be the value 80.
The value 2 (third argument) tells the VLOOKUP function to return the value In the same row
from the second column of the red table.
First Match
If the leftmost column of the table contains duplicates, the VLOOKUP function matches the first
instance. For example, take a look at the VLOOKUP function below.
Index Function
Below is a table showing people’s name, height and weight. We want to use the INDEX formula
to look up Kevin’s height… here is an example of how to do it.
Follow these steps:
1. Type “=INDEX(” and select the area of the table then add a comma
2. Type the row number for Kevin, which is “4” and add a comma
3. Type the column number for Height, which is “2” and close the bracket
4. The result is “5.8”
Match Function
Sticking with the same example as above, let’s use MATCH to figure out what row Kevin is in.
Follow these steps:
1. Type “=MATCH(” and link to the cell containing “Kevin”… the name we want to look up
2. Select the all the cells in the Name column (including the “Name” header)
3. Type zero “0” for an exact match
4. The result is that Kevin is in row “4”
Use MATCH again to figure out what column Height is in.
1. Type “=MATCH(” and link to the cell containing “Height”… the criteria we want to look
up
2. Select all the cells across the top row of the table
• Now we can take the two MATCH formulas and use them to replace the “4” and the “2” in the
original INDEX formula. The result is an INDEX MATCH formula.
1. Cut the MATCH formula for Kevin and replace the “4” with it
2. Cut the MATCH formula for Height and replace the “2” with it
3. The result is Kevin’s Height is “5.8”
5.