Professional Documents
Culture Documents
Excel Basics: Vlookup & Hlookup Explained
Excel Basics: Vlookup & Hlookup Explained
1
>>
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
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.
Illustration 2 - Hlookup (for Horizontal Tables) Names Sales Region Chintan 200 West Chirag 220 North Abhinav 240 South Kishore 260 East Faisal 280 West
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
>>
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
Illustration 4 - Horizontal Tables Type 1 Names Sudhir Ajay Sales 100 120 Region West North Type 2 Names Sales Region Dept.
3
>>
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
Note: How Vlookup fails to pickup corresponding data for a lookup value t does not lie in the 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
Note: After shifting the 'Sales' column t the first position the formula returns th right answer!
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.
Dept. Finance HR
w Vlookup fails to pickup nding data for a lookup value that lie in the first column
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
Chirag Chintan Abhinav Ali Faisal Kishore 220 200 240 300 280 260 North West South South West East