Class 7 - Summary - Lookups in MS Excel-3998
Class 7 - Summary - Lookups in MS Excel-3998
SESSION OVERVIEW:
By the end of this session, the students will be able to:
● Understand VLOOKUP function in detail which will include the importance,
drawbacks and the syntax of VLOOKUP.
● Understand HLOOKUP function in brief.
● Understand INDEX-MATCH functionality in excel.
1. VLOOKUPs IN EXCEL:
a. Introduction (5 min):
In the previous lecture while working with the ABC company’s datasets, we noticed
that it was difficult to work on those tables without merging both the tables. Thus, we
will be understanding ways by which we can merge two or multiple tables for the
ease of understanding the datasets as a whole, get accurate insights and many more.
1
● Scalability: VLOOKUP is scalable and can handle large datasets with ease.
Whether you're working with hundreds or thousands of records, the function
can efficiently retrieve the required information without compromising
performance.
● Ease of Use: Despite its powerful capabilities, VLOOKUP is relatively easy
to understand and use, even for users with basic Excel skills. This makes it
accessible to a wide range of users and allows for quick adoption in various
business environments.
Parameters:
1. lookup_value: The value to search for in the first column of the table or
range.
This is the value you want to search for in the first column of your table or
range. It could be a number, text, or reference to a cell containing the value.
2. table_array: The table or range of cells where the data is stored. This should
include the column where the lookup value is found and the column from
which to retrieve the data.
This is the range of cells containing the data you want to search through. The
lookup value must be in the first column of this range.
3. col_index_num: The column number in the table_array from which to
retrieve the data. The first column in the table_array is 1.
For example, if the data you want is in the third column of the table array, the
column index number would be 3.
4. range_lookup (optional): A logical value that specifies whether to perform
an exact or approximate match. If TRUE or omitted, an approximate match is
performed. If FALSE, an exact match is required.
Example:
In this example:
● The cell ‘A2’ contains the employee ID you want to look up.
● EmployeeTable is the range of cells containing the employee ID in the first
column and their names in the second column.
2
● 2 specifies that you want to retrieve the name from the second column of the
EmployeeTable.
● FALSE specifies that you want an exact match for the employee ID.
STEPS:
● Click on the first cell of your target column (where you want the
VLOOKUP results to appear).
● Type =VLOOKUP, followed by opening parentheses.
● Next, select the cell containing the value you want to lookup
● Select the second sheet tab. Select the range of cells that you want
VLOOKUP to search in. The range of cells that we will be
referencing to need to be absolute, means addition of the $ sign is
required. Example, if we have a range of cells A2:E40, to apply
absolute referencing we it must be $A$2:$E$40.
● Put a comma, followed by the index of the column that contains the
values you want to retrieve
● Finally, close the parentheses.
This Dataset-1(contains table-1 and the final table after merging) and dataset-2
(contains table-2 which was merged with table-1) can be used to showcase the
VLOOKUP function from another sheet but the same workbook.
3
● Open the second workbook. Select the range of cells that you want
VLOOKUP to search in. The range of cells that we will be
referencing to need to be absolute, means addition of the $ sign is
required.
● Put a comma, followed by the index of the column that contains the
values you want to retrieve.
● Finally, close the parentheses.
NOTE: This is how the formula looks when we merge two tables from two
different workbooks.
datasets.
4
table array contains a significant number of rows. In such cases, users may
experience slower calculation times, especially if the formula is used
extensively throughout a workbook.
● Inability to Look Left: Unlike HLOOKUP (Horizontal Lookup), which
searches for values in the first row of a table array and retrieves values from
rows below, VLOOKUP cannot perform leftward lookups. This means users
cannot retrieve values from columns to the left of the lookup column without
restructuring the data.
Example: (Dataset)
Let’s consider the example mentioned below.
Now if our objective is to fetch the data for the student D in management then we can
use HLOOKUP as follows:
Now, to populate the desired variables in the formula, we will select variables as
follows:
5
The output for the following will be as follows:
6
indices like VLOOKUP and HLOOKUP, but instead uses a more dynamic
and efficient matching mechanism.
● No Limitation on Lookup Column: VLOOKUP restricts the lookup value
to the leftmost column of the lookup range, while HLOOKUP restricts it to
the top row. INDEX-MATCH imposes no such limitation, allowing users to
search for values in any column or row within the specified range.
● Better Handling of Dynamic Data: VLOOKUP and HLOOKUP struggle
with dynamic datasets where the lookup value's position may change.
INDEX-MATCH excels in such scenarios, as it dynamically adjusts to
changes in the dataset without requiring manual adjustments.
=INDEX() returns the value of a cell in a table based on the column and row
number.
=MATCH() returns the position of a cell in a row or column.
b. INDEX function:
The INDEX function in Excel is used to retrieve a value from a specified range of
cells based on its row and column numbers. It's particularly useful for dynamic data
retrieval and manipulation.
7
Figure: Represents the MATCH function in Excel
● return_range: This is the range of cells from which you want to retrieve the
result.
● lookup_value: This is the value you want to find within the lookup_range.
● lookup_range: This is the range of cells where you want to search for the
lookup_value.
● [match_type]: [Optional] This argument specifies the type of match you
want to perform, similar to the MATCH function.
dataset
dataset