Lab Tutorial Vlook Up
Lab Tutorial Vlook Up
Instructor:
Table of Contents
VLOOKUP ............................................................................................................................................. 1
A. VLOOKUP FOR APPROXIMATE MATCHES (TRUE KEYWORD AS THE LAST
PARAMETER) .......................................................................................................................... 2
B. VLOOKUP FOR EXACT MATCHES (FALSE KEYWORD AS THE LAST
PARAMETER) .......................................................................................................................... 4
TWO-WAY LOOKUP ........................................................................................................................... 8
VLOOKUP
The VLOOKUP function is one of the most popular functions in MS-Excel. VLOOKUP is an
Excel function to lookup and retrieve data from a specific column in table. The "V" stands for
"vertical".
VLOOKUP supports:
• Approximate matching
• Exact matching,
Syntax:
1
Prepared by: Wan Aryati Wan Ghani
A. VLOOKUP FOR APPROXIMATE MATCHES (TRUE KEYWORD AS THE
LAST PARAMETER)
Consider a scenario where a table calculates discounts for the customers who do not want to
buy exactly tens or hundreds of items.
As shown below, certain Company has imposed discounts on the quantity of items ranging
from 1 to 10,000:
Lookup Table
– Table_Array
Now it is uncertain that the customer buys exactly hundreds or thousands of items. In this case,
Discount will be applied as per the VLOOKUP's Approximate Matches. In other words, we do
not want to limit them for finding matches to just the values present in the column that are 1,
10, 100, 1000, 10000.
1. Click on the cell where the VLOOKUP function needs to be applied i.e. Cell reference 'I2'.
Cell reference I2
where VLOOKUP
needs to be applied
2. Enter '=VLOOKUP()' in the cell. In the parenthesis enter the set of Arguments for the
above instance.
2
Prepared by: Wan Aryati Wan Ghani
Enter the Arguments:
3. Argument 1: For the lookup_value, enter the Cell reference of the cell at which the value
present will be searched for the corresponding value in the lookup table.
4. Argument 2: Choose the lookup table or the table array in which you want VLOOKUP
to search for the corresponding value.(In this case, choose the columns Quantity and
Discount)
5. Argument 3: The third argument would be the column index in the lookup table you want
to be searched for the corresponding value.
6. Argument 4: Last argument would be the condition for Approximate Matches or Exact
Matches. In this instance, we are particularly looking for the Approximate matches
(TRUE Keyword).
Column 1 Column 2
7. Press 'Enter’. VLOOKUP formula will be applied to the mentioned Cell reference, and
when you enter any number in the quantity field, it will show you the discount imposed
based on Approximate Matches in VLOOKUP.
3
Prepared by: Wan Aryati Wan Ghani
Discount shown
based on
approximate quantity
NOTE: If you want to use TRUE as the last parameter, you can leave it blank and by default
it chooses TRUE for Approximate Matches.
Company Salary Table which is managed by the financial team of the Company – In Company
Salary Table, start with a piece of information which is already known (or easily retrieved).
Information that serves as an index.
Example:
Start with the information which is already available.
(In this Case, Employee's Name)
4
Prepared by: Wan Aryati Wan Ghani
To find out the Employee Salary which we don’t know, enter the Employee Code which is
already available.
1. Navigate the cell to view the Salary of the particular Employee.- (in this example, click cell
'H2').
2. Enter the VLOOKUP Function in cell H2.
5
Prepared by: Wan Aryati Wan Ghani
3. First Argument: the first argument would be the cell reference for the value that needs to
be searched or the lookup value. (In this case, Employee Code is considered as the lookup
value so that the first argument will be H2, i.e., the value which needs to be looked up or
searched, will be present on the cell reference 'H2').
4. Second Argument: Choose the lookup table or the table array in which you want
VLOOKUP to search for the corresponding value. In this example, the lookup table would
be from cell reference B2 to E25, i.e., the complete block where the corresponding value
would be searched.
NOTE: The lookup values or the data you know have to be in the left-hand column of your
lookup table,i.e., your cell range.
5. Third Argument: : It refers to the column reference. In other words, it notifies VLOOKUP
where you expect to find the data, you want to view. In this case, the column reference
would be 4 as the Employee's Salary column has an index of 4 as per the lookup table.
1 2 3 4
6. Fourth Argument: The last argument is range lookup. It tells the VLOOKUP function
whether we want the approximate match or the exact match to the lookup value. In this
case, we want the exact match ('FALSE' keyword).
• FALSE: Refers to the Exact Match.
•
6
Prepared by: Wan Aryati Wan Ghani
• TRUE: Refers for Approximate Match
7. Press 'Enter' to notify the cell that we have completed the function. However, you get an
error message as below because no value has been entered in the cell H2. i.e. No employee
code has been entered in Employee Code which will allow the value for lookup.
However, as you enter any Employee Code in H2, it will return the corresponding value i.e.
Employee's Salary
In summary, what happened through the VLOOKUP formula is that the values which we enter
in cell H2 are present in the left-hand column of the data, i.e., depicting the column for
Employee's Code. Now, we must look through the lookup table and in the fourth column to the
right of the table, we have to find the matching value in the same row, i.e., the corresponding
value (Employee's Salary) in the same row of the corresponding Employee's Code.
The above example shows the Exact Match in VLOOKUP, i.e., FALSE Keyword as the last
parameter.
7
Prepared by: Wan Aryati Wan Ghani
TWO-WAY LOOKUP
This example teaches how to lookup a value in a two-dimensional range. A formula with
VLOOKUP and MATCH work correctly even changes are made to columns.
Example:
In the example, a formula is used to dynamically lookup both rows and columns with
VLOOKUP.
We can change either the column (i.e Month) or the row (i.e Zone), and the VLOOKUP formula
fetches the correct quantity.
To make this two-way lookup formula, we need to make the column dynamic as well. So,
when a user changes the Zone, the formula automatically picks the correct column (i.e Month)
Use the MATCH function as the column argument (col_index_num). And for this, we need to
combine match function with vlookup. Normal vlookup is only able to return a value by
looking into a single column at a time.
The reason is, the col_index argument of vlookup is a static value. But if you combine match
function with vlookup you can make it dynamic.
8
Prepared by: Wan Aryati Wan Ghani
Here are the steps.
1. Enter the VLOOKUP function in cell B3.
=VLOOKUP(B1,A5:E17,MATCH(B2,A5:E5,0),0)
2. MATCH function is used to make col_index dynamic. This formula works in two parts.
When you select zone, match function returns the position of the zone in the heading row.
And, then vlookup uses that position to get value from that column.
Whenever we need to get value from a table [Matrix] we can simply use this combination of
two functions to get that value. It’s simple and easy to apply.
9
Prepared by: Wan Aryati Wan Ghani