How to Use HLOOKUP Function in Google Sheets (3 Examples)

When working with a large volume of data it can be tiring and time-consuming to go back and forth to look for specific data in a particular cell of a row. In that case, Google Sheets provides the HLOOKUP function that saves you time and trouble by looking up specific data from a row for you. In this article, we will try to learn how to use HLOOKUP function in Google Sheets easily and effectively.


A Sample of Practice Spreadsheet

Download this spreadsheet to practice yourself.


What Is HLOOKUP Function in Google Sheets?

HLOOKUP also stands for Horizontal lookup. This function searches for data across the first row of a range and returns the value of a specified cell in the column where it finds the data. The HLOOKUP function returns values both for approximate and as well as for accurate matches.

The HLOOKUP function is quite similar to the VLOOKUP function which is used when data is listed in columns instead of rows. The VLOOKUP function looks for a value in the leftmost column of the table, on the contrary, the HLOOKUP function looks for a value in the first row of the table.

Syntax

The syntax of the HLOOKUP function is given below:

HLOOKUP(search_key, range, index, [is_sorted])

google sheets hlookup function

Arguments

ARGUMENT REQUIREMENT FUNCTION
search_key Required The value to look for.
range Required The range where to look up the value.
index Required The row number of the value to return. The first row in the range is numbered 1.
[is_sorted] Optional It is TRUE by default. It indicates whether the row to look for is sorted or not. If is_sorted is TRUE, then the nearest match is returned. If is_sorted is FALSE, only an exact match is returned.

Output

The formula =HLOOKUP("001",B4:F6,2,FALSE) will give the Employee Name George based on the criteria Employee ID 001 from the range B4:F6 where the row C5:F5 contains the Employee Names.


3 Examples of Using HLOOKUP Function in Google Sheets

1. Using HLOOKUP Function for Horizontal Lookup

To use the HLOOKUP function, consider a dataset with Employee ID, Employee Name, and the Sales Amount of each Employee. We will search for the Sales amount of Employee ID 002 using the HLOOKUP function.

dataset for google sheets hlookup

Steps:

  • First, go to the cell where you want to show the looked-up value. We go to cell C10 in our example.

select cell to use hlookup function in google sheets

  • Then, insert the HLOOKUP function.

insert hlookup function

  • After that, type the value you want to look up followed by a comma. We type D4 as we want to look up Employee ID 1.

insert lookup value

  • Next, type the range where you want to look up the value followed by a comma. We type B4:F6 as the data we want to look up is in this range.

insert range to lookup value

  • Now, type the row number of the data that you want to show followed by a comma. We type 3 as the data is in the 3rd row of our data table.

insert row number

  • After that, type FALSE if you want to look for an exact match.

insert false as parameter to hlookup in google sheets

  • Then, close parentheses for the HLOOKUP function and this is how the final formula looks:
=HLOOKUP(D4,B4:F6,3,FALSE)

final formula to use hlookup in google sheets

  • Finally, press ENTER to show the value that you looked up.

final result after applying hlookup in google sheets


2. Applying MAX Function with HLOOKUP Function

The MAX function can be used with the HLOOKUP function to look for the Employee who made the most sales. Consider the dataset we used for the previous method.

dataset for applying MAX function with hlookup

Steps:

  • First, go to the cell where you want to show the employee name who made the most sales. We go to cell C8 for our example.

select desired cell

  • Then, type in the following formula:
=HLOOKUP(MAX(C5:F5),C5:F6,2,FALSE)

final formula to use max function with hlookup in google sheets

Formula Explanation:

  • C5:F5 is the range where the MAX function looks for the highest value.
  • C5:F6 is the range of the HLOOKUP function to look up the value.
  • 2 is the row number of the data that the HLOOKUP function wants to show.
  • FALSE as we want the HLOOKUP function to return an exact match for the value.
  • Finally, press ENTER to show the employee who made the most sales.

final result after applying max with hlookup

Read More: How to HLOOKUP for Multiple Criteria in Google Sheets (2 Ways)


3. Selecting TRUE as HLOOKUP Parameter

In the above examples, we used FALSE as the last or fourth parameter. Now, we will see how the value changes if we select TRUE as the last parameter.

3.1 Using Unsorted Data

Consider the following dataset. We will try to find which employee made a sale of $300 using unsorted data.

dataset for using TRUE as parameter

Steps:

  • Go to the cell where you want to show the result and, type the following formula:
=HLOOKUP(300,C5:F6,2,TRUE)

Formula Explanation:

  • 300 is the value that HLOOKUP is looking for.
  • C5:F6 is the range where the HLOOKUP is looking for the value 300.
  • 2 is the row number if when the HLOOKUP finds a match we want the data to return from that row.
  • TRUE is used for HLOOKUP to find an approximate match. It will show the result even if it does not find an exact match.

formula to use true as parameter

  • Notice how the HLOOKUP function shows the name Peter as Peter is the employee who made the sales closest to $300.

result after using true as parameter

  • However, if we had used FALSE as the fourth parameter instead of TRUE, then the following error message would have been shown.

result after using false as parameter


3.2 Using Sorted Data

Consider the following dataset where the data in the first row are sorted. We will try to find who made the sale of $300 using this dataset. The Sales Amount are sorted in ascending order. Notice that we have no employee who made $300 in sales in our dataset. Let’s see how the HLOOKUP behaves.

dataset used for sorted data

Steps:

  • Go to the cell where you want to show the result and, type the following formula:
=HLOOKUP(300,C4:F6,2,TRUE)

formula to use true in sorted dataset

  • The formula returns the name Peter. This happens because the HLOOKUP function does not look for an exact match, rather it looks for an approximate match and shows the name Peter.

result after using true as parameter in sorted dataset

  • Alternatively, if we used FALSE as the last parameter instead of TRUE then an error message would show because the formula does not find an exact match. This is the formula that we use:
=HLOOKUP(300,C4:F6,2,FALSE)

using false as parameter in sorted dataset


Limitations of the HLOOKUP Function in Google Sheets

Although the HLOOKUP is a very useful function for looking up values in Google Sheets, there are some problems with it. They are:

  • When looking up the value, the formula always uses the first row to look for the value. You can not look up a value below the first row.
  • The formula is not sufficiently dynamic. It means that if you insert another row between the range, it will not automatically update the index.

Conclusion

In this article, we showed you how to use the HLOOKUP function in Google Sheets with different examples. Keep practicing the examples that we have shown here for a better understanding of the concept. We hope this article was useful to you to help you.

Also, check out other articles on OfficeWheel to keep on improving your Google Sheets work knowledge.


Related Articles

Maruf Niaz

Maruf Niaz

My Name is Niaz. As a regular Google Sheets user, I have a good understanding of the users' needs and bad experiences. In my articles, I will share my knowledge which I hope, will be helpful to you. My latest educational degree was BSc in Textile Engineering from Bangladesh University of Textiles.

We will be happy to hear your thoughts

Leave a reply

OfficeWheel
Logo