VLOOKUP &
HLOOKUP in
Microsoft Excel
Lookup
function
The LOOKUP function in Excel is a versatile tool for searching and
retrieving data from a range or an array. It is used to find a value
0 either in a single row or column and return a value from the
same position in another row or column.
1 Function Syntax:
=LOOKUP(lookup_value, lookup_vector, [result_vector])
=LOOKUP(lookup_value, Table_array)
Lookup
• function
lookup_value: The value you want to search for. It can be
a text, number, or a reference to a cell containing the
0 value.
• lookup_vector: The range that contains the data you are
searching through. This must be a single row or column.
2
• result_vector: Optional. The range from which you want
to return the corresponding value. This also must be a
single row or column and of the same size as
lookup_vector.
Introductio
VLOOKUP (Vertical Lookup) and HLOOKUP (Horizontal Lookup) are
n functions used for searching and retrieving
two powerful Excel
data from a specific row or column in a table.
0 •VLOOKUP: Searches for a value in the first column of a table and
returns a value in the same row from a specified column. It's useful
for vertically structured data.
3
•HLOOKUP: Searches for a value in the first row of a table and
returns a value in the same column from a specified row. It's ideal
for horizontally structured data.
These functions are essential for anyone dealing with large
datasets, as they help in quickly finding and organizing
information.
Importance of lookup
function
Data Retrieval: VLOOKUP and HLOOKUP streamline the process of
finding specific information in large datasets. Instead of manually
0
searching through rows and columns, these functions quickly pinpoint
the data you need.
Efficiency: They save time and reduce the risk of errors when working
4
with extensive data tables. Automating the lookup process ensures
consistency and accuracy.
Data Management: With VLOOKUP and HLOOKUP, you can easily
combine and compare data from different sources. This is crucial for
tasks like generating reports, performing analysis, or merging datasets.
Understanding VLOOKUP
VLOOKUP (Vertical Lookup) is a powerful function in Excel that
0
helps you find information in a large dataset quickly and
efficiently. Here's a deeper dive into what it is and how it
works:
5 Function Syntax:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Understanding VLOOKUP
•lookup_value: This is the value you're trying to find. It can be
a number, text, or a cell reference.
0 •table_array: The range of cells that contains the data. Ensure
your first column includes the lookup_value.
•col_index_num: The column number in the table_array from
6 which you want to retrieve the value. For example, if you want
data from the second column, you'd enter 2.
•range_lookup: This is optional and determines whether you
need an exact match (FALSE) or an approximate match (TRUE).
Understanding VLOOKUP
Common Errors:
•#N/A: The lookup value is not found.
0 #REF!: The col_index_num is greater than the number of columns in
table_array.
•#VALUE!: Invalid arguments, such as non-numeric col_index_num.
7 To fix error:
Formula
=IFERROR(VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]))
Example
Raw Data Extract
Employee ID Last Name First Name
110608Doe John
0
253072Cline Andy
352711Smith John
391006Pan Peter
392128Favre Bret
549457Elway John
8
580622Manning Eli
602693Vick Micheal
611810Woods Tiger
612235Jordan Micheal
795574Stark Tony
830385Williams Prince
990678Pitt Brad
Example
Pay Report
Employee ID Pay First Name Last Name
990678 $84,289
830385 $137,670
0 795574
580622
549457
392128
$190,024
$122,604
$111,709
$85,931
9
391006 $168,114
352711 $89,627
253072 $149,946
612235 $145,893
611810 $64,757
602693 $71,478
110608 $131,505
Solution
Formula-: VLOOKUP(A4, A4:C16, 2,0)
Pay Report
Employee ID Pay First Name Last Name
1
990678 $84,289 Brad Pitt
830385 $137,670 Prince Williams
795574 $190,024 Tony Stark
580622 $122,604 Eli Manning
549457 $111,709 John Elway
0
392128 $85,931 Bret Favre
391006 $168,114 Peter Pan
352711 $89,627 John Smith
253072 $149,946 Andy Cline
612235 $145,893 Micheal Jordan
611810 $64,757 Tiger Woods
602693 $71,478 Micheal Vick
110608 $131,505 John Doe
Understanding HLOOKUP
HLOOKUP (Horizontal Lookup) is another powerful function in
1
Excel used to search for a value in the first row of a table or
array of values and return a value in the same column from a
specified row.
1 Function Syntax:
=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
Understanding HLOOKUP
Arguments:
:
1.lookup_value The value you want to search for in the first row of the table.
:
2.table_array The range of cells containing the data (including the row
1 where the lookup happens).
3.row_index_num : The row number (relative to table_array) from which to
2
return the value.
4.range_lookup (optional):
•TRUE (default): Finds an approximate match. If an exact match isn't
found, it uses the largest value less than lookup_value.
•FALSE: Finds an exact match. If not found, it returns an error.
Example
A B C D
ID 101 102 103
Name John Alice Bob
1 Score 85 90 78
3
Formula:
To find the Score of ID 102:
=HLOOKUP(102, A1:D3, 3, FALSE)
Example
Explanation:
•lookup_value = 102 (the ID to search for).
1 •table_array = A1:D3 (includes the entire data table).
•row_index_num = 3 (returns the value from the third row of the table).
4 •range_lookup = FALSE (looks for an exact match).
Result:
The function will return 90 (the Score for ID 102).
Than
k You