HLOOKUP vs VLOOKUP – 5 Key Differences
The LOOKUP function works like an index page in a book where we look at the topic to locate its page number. You’ll find the LOOKUP functions like HLOOKUP, VLOOKUP, and XLOOKUP in Excel categorized under Lookup and Reference functions. The LOOKUP function finds a match by comparing cells in a row or column and returning the answer from another row or column.
In this guide, we will see a brief overview of the HLOOKUP vs VLOOKUP functions and see how they compare against each other.
You’ll learn:
HLOOKUP
The HLOOKUP function in Excel searches for a value in the table horizontally. The lookup values must appear in the first row of the table and move horizontally towards the right.
Syntax
=HLOOKUP(lookup_value, table_array,row_index_num,[range_lookup]) |
Parameters
- lookup_value – Specifies the value to search across the cells.
- table_array – Specifies the table range where the lookup_value has to be searched.
- row_index_num – It is the position of the row from where to get the result.
- range_lookup – It is an optional parameter and returns the exact match when FALSE is mentioned and returns the approximate match or closest match when TRUE is mentioned.
VLOOKUP
VLOOKUP stands for ‘Vertical Lookup’. It searches for a specified value in a column and returns the result from another column in the same row.
Syntax
=VLOOKUP ( lookup_value,table_array,col_index_num,[range_lookup) |
Parameters
- lookup_value – This is the value to search across the cells to get the match and return the corresponding value from the other column.
- table_array – This argument takes the starting value and the ending value of the cell where the function has to search.
- col_index_num – The value in this argument represents the exact index of the column to look into.
- range _lookup – It accepts two values, one is TRUE, and another is FALSE.
- The function returns the closest match if TRUE is mentioned.
- The function returns the exact match if FALSE is mentioned.
This parameter is optional and returns TRUE by default if it is not mentioned in the formula.
HLOOKUP vs VLOOKUP – Example
In the example above, the HLOOKUP formula takes the lookup_value A2 which is the country, US. The HLOOKUP function moves horizontally starting from the first row to the row number that you mention. The second parameter is the table_array which takes the ranges of cells across which the data is spread.
The third parameter takes a numeric value that mentions the position of the row from the first row. Here, it is the value 3, which refers to the third row from A2. The function returns the value Japan.
Similarly, the VLOOKUP formula can be parsed to check how it executes. Use the VLOOKUP formula when you move from one column to another, vertically. In the example above, the lookup_value is A4 and the value to fetch is in the third column.
Mention the formula as, =VLOOKUP(A4,A2:D6,3,FALSE). The VLOOKUP formula takes the lookup_value, A4, and moves vertically three columns towards the right and picks up the value there, and returns it. Remember that the VLOOKUP formula cannot move backward from right to left.
A note of caution when you use the HLOOKUP formula is that it searches from top to bottom and cannot search from bottom up. Also, it searches from the starting cell of the table and not from anywhere inside the table.
Let’s look at the example below. The HLOOKUP formula takes A4 as the lookup_value. The table_array is mentioned as A2:D6, and the row_index_num is mentioned as 2. The function starts to look for a value in the second row and must return as the UK, but it returns as #N/A.
The reason is that the HLOOKUP function looks at the lookup_value A4 and wants to proceed down. But the table_array parameter mentions the starting cell from A2, which requires the function to move upwards which HLOOKUP cannot do. Hence, it returns the message #N/A.
If your search starts from the middle of the table, then mention the formula as follows. =HLOOKUP(A4,A4:D6,2,FALSE). You can see that the table_array is also changed according to the lookup_value to make the formula search from A4 which it considers as the starting of the table.
HLOOKUP vs VLOOKUP – Key Differences
HLOOKUP | VLOOKUP | |
1. | It looks for values horizontally across the table. | It looks for values vertically across the table. |
2. | HLOOKUP is useful when the data is arranged row-wise. | VLOOKUP is used to compare and pick data arranged in columns. |
3. | This function searches from the top to the bottom and it cannot search the bottom-top. | It searches from left to right and not in reverse. |
4. | It returns the value from the same column, a few rows apart. | It returns the value from the same row but a few columns apart. |
5. | HLOOKUP is not widely used. | VLOOKUP is extensively used. |
Let’s Wrap Up
In this article, we learned about HLOOKUP vs VLOOKUP functions along with some examples, and the key differences between them. VLOOKUP is used more extensively than HLOOKUP because of common data arrangements. There is also a new function, called the XLOOKUP, which is a combination of HLOOKUP and VLOOKUP. But, XLOOKUP is only available in Excel for Office 365. Read our detailed guide on XLOOKUP vs VLOOKUP to learn more.
We hope you found this article useful. Please let us know if you face any difficulties while working with the LOOKUP functions. We are happy to help you.
Please visit our free resources section for more high-quality Excel guides.
Ready to upskill your Excel knowledge? Simon Sez IT has been teaching Excel for over ten years. For a low, monthly fee you can get access to 130+ training courses. Click here for advanced Excel courses with in-depth training modules.