Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 10

Excel Basics

Vlookup & Hlookup Explained

1
>>

Vlookup and Hlookup Syntax & workings

Purpose Syntax

Perform look-ups in Vertical & Horizontal tables (i.e. Tables wher Headers are in Vertical or Horizontal format , hence the name. =VLOOKUP(lookup_value,table_array,col_index_num,range_loo =HLOOKUP(lookup_value,table_array,row_index_num,range_lo

Illustration 1 - Vlookup (For Vertical Tables) Names Sudhir Ajay Yogesh Lokesh Rahul Chintan Chirag Abhinav Kishore Faisal Ali Hussain Sales 100 120 140 160 180 200 220 240 260 280 300 320 Region West North South East West South East West North South East West

Table Array The entire table, including headers

Column Number The column numbe data In our example we of Abhinav, the sal left).

=VLOOKUP("Abhinav",D21:F33,2,0)

Lookup Value The value for which we want to find the corresponding data.

What are the Sales made by Abhinav? 240 =VLOOKUP("Abhinav",D21:F33,2,0)

Illustration 2 - Hlookup (for Horizontal Tables) Names Sales Region Chintan 200 West Chirag 220 North Abhinav 240 South Kishore 260 East Faisal 280 West

What are the Sales made by Abhinav? 240 =HLOOKUP("Abhinav",D41:J43,2,0)

Note: Both Vlookup and Hlookup suffer from a serious shortcoming - The range containing the 'lookup value' must be in the first row (in case of Hlookup) and first column (in case of Vlookup)

2
>>

So what is a Horizontal or Vertical table?

Myth Fact

A popular misconception is that if number of rows are more than columns must be a vertical column and vice-versa If the 'Table Headers' are vertical the Table is called a Horizontal one and v versa

Illustration 3 - Vertical Tables Type 1 Names Sales Region Sudhir 100 West Ajay 120 North Yogesh 140 South Lokesh 160 East Rahul 180 West Chintan 200 South Chirag 220 East Abhinav 240 West Kishore 260 North Faisal 280 South Ali 300 East Hussain 320 West

Type 2 Names Rahul Chintan

Sales 180 200

Illustration 4 - Horizontal Tables Type 1 Names Sudhir Ajay Sales 100 120 Region West North Type 2 Names Sales Region Dept.

Yogesh 140 South

Lokesh 160 East

Rahul 180 West

Rahul 180 West Finance

Chintan 200 South HR

3
>>

Pitfalls to watch out for!

Pitfall Solution

The problem with both V & Hlookup is that they only generate valid answe when the 'lookup value' lies in the first column (for Vlookup) & first row (for Hlookup) The row/column containing the lookup value must be shifted to the first position using 'Insert Cut Cells' feature (a neater version of cut & paste

Illustration 5 - Lookup Value is in second column Names Sudhir Ajay Yogesh Lokesh Rahul Chintan Chirag Abhinav Kishore Faisal Ali Hussain Sales 100 120 140 160 180 200 220 240 260 280 300 320 Region West North South East West South East West North South East West

Who made sales worth >> #N/A =VLOOKUP(K107,D107:F119,1,0

Note: How Vlookup fails to pickup corresponding data for a lookup value t does not lie in the first column

Illustration 6 - Lookup Value shifted to First column

Step 1 - Cut the 'Sales' column within the table using 'Ctrl + X' Step 2 - Come to the first cell within the table (First cell from the left of the table header Step 3 - Press 'Right Click' followed by 'E' followed by 'Enter' Note: In case your keyboard does not have a 'Right Click' (usually between 'Alt' & 'Ctrl' on the right side) you may use 'Shift + F10' Solved Sales 100 120 140 160 180 200 220

Names Sudhir Ajay Yogesh Lokesh Rahul Chintan Chirag

Region West North South East West South East

Who made sales worth >> Kishore =VLOOKUP(K107,D107:F119,1,0

Note: After shifting the 'Sales' column t the first position the formula returns th right answer!

240 260 280 300 320

Abhinav Kishore Faisal Ali Hussain

West North South East West

www.finaticsonline.com

izontal tables (i.e. Tables where tal format , hence the name. rray,col_index_num,range_lookup) rray,row_index_num,range_lookup) Column Number The column number of the corresponding data for the lookup value. In our example we wanted to find out sales of Abhinav, the sales column is 2nd (from left).

",D21:F33,2,0)

Range Lookup For choosing an exact match enter 0 or False . For choosing an approximate match enter 1 or True. Unless specifically needed do not use Approximate match as it may result in erroneous answers.

Ali 300 South

ortcoming - The range case of Hlookup) and

f rows are more than columns it

s called a Horizontal one and vice-

Region West South

Dept. Finance HR

Chintan 200 South

hey only generate valid answers mn (for Vlookup)

e must be shifted to the first ater version of cut & paste

sales worth >> 260 =VLOOKUP(K107,D107:F119,1,0)

w Vlookup fails to pickup nding data for a lookup value that lie in the first column

om the left of the table header)

usually between 'Alt' & 'Ctrl' on

sales worth >> 260 =VLOOKUP(K107,D107:F119,1,0)

er shifting the 'Sales' column to osition the formula returns the wer!

www.finaticsonline.com

Names Sudhir Ajay Yogesh Lokesh Rahul Chintan Chirag Abhinav Kishore Faisal Ali Hussain Names Sales Region

Sales 100 120 140 160 180 200 220 240 260 280 300 320 Chintan 200 West

Region West North South East West South East West North South East West Chirag 220 North Abhinav 240 South

Names Yogesh Sudhir Rahul Lokesh Kishore Hussain Faisal Chirag Chintan Ali Ajay Abhinav Kishore 260 East

Sales 140 100 180 160 260 320 280 220 200 300 120 240 Faisal 280 West

Region South West West East North West South East South East North West Ali 300 South

Names Sales Region

Chirag Chintan Abhinav Ali Faisal Kishore 220 200 240 300 280 260 North West South South West East

You might also like