ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How to Use the HLOOKUP Function in MS Excel 2016

Updated on January 1, 2019
THEAMAZINGJAMES profile image

James likes to learn about technology and share what he learns through his articles.

HLOOKUP Function

The HLOOKUP function may not be as popular as its cousin the VLOOKUP function, but still serves as an important function when certain situations prevail. This function has plenty of applications in the business world.
The HLOOKUP function may not be as popular as its cousin the VLOOKUP function, but still serves as an important function when certain situations prevail. This function has plenty of applications in the business world.

Introduction

The HLOOKUP function is a Microsoft Office tool that has a lot of power considering what it can do and the amount of applications that it can be utilized for. In this article I explain the basic instructions on how use the HLOOKUP function as a lookup/reference tool for displaying information. This tutorial is explained in Microsoft Excel 2016, but can be used as reference for Excel 2007 and higher versions. If you are a beginner with Excel functions don't be fearful. This tutorial is very basic and straight forward.

How it Works

The HLOOKUP function is useful because it can display information by using a reference value within the function. The H in HLOOKUP stands for Horizontal. When this function is utilized a piece of selected data from a row (horizontally aligned data) is referenced. After the match is made, data from a preselected row is returned to display in the cell where the function is located. An illustration of the function's process can be seen in the illustration below.

Another function that is like the HLOOKUP function is the VLOOKUP function. The V in VLOOKUP stands for vertical. The VLOOKUP has the same premise except it references information in the first column of the array to display information found in other columns.

HLOOKUP Process

The HLOOKUP Excel function can be understood through this illustration. A piece of data is referenced in the first row of a table. The match is made, then a value is returned to display data that comes from a preselected a row.
The HLOOKUP Excel function can be understood through this illustration. A piece of data is referenced in the first row of a table. The match is made, then a value is returned to display data that comes from a preselected a row.

Setting Up the Function

The HLOOKUP function structure is shown below:

=HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

The first value in the function is the lookup value. Excel uses this value to search for a match in the range. The lookup value used can be a reference, number or even a formula. After the value is found in a row, Excel will can return other data to relating to that value.

The next value in the function is the table array. The table array contains row values that will be searched for and any data that may be returned to the HLOOKUP function cell. This array may be referred to as the lookup table or the lookup range.

The next value in the function is the row index number. This is the row that contains that value that you want returned to the cell that contains the function arguments. This will be inputted as a number greater than 1.

The range lookup is going to be stated as true or false. A true statement will make an approximate match when referencing the lookup table and the false statement will look for an exact match.

Diagram of the HLOOKUP Function

The diagram above demonstrates the what each element of the function relates to.
The diagram above demonstrates the what each element of the function relates to.

HLOOKUP Example

To become more familiar with the HLOOKUP function it's best to look at a simple example. The illustration below shows a table with student test scores, averages and a column for a letter grade on the far-right side. The reason for using a VLOOKUP here is to have a letter grade automatically appear and change as grade averages change.

Inserting a Function

A function can be manually typed but here we will use the insert function button since this method provide some assistance to beginner if needed. To take the first step to inserting a function you must click into the cell where you need the function (letter grade) to appear. Next, click on the function tab in the main tabs section, then click on the insert function button.

First Step to Inserting a Function

Find the Function

A window should appear titled insert function. To find the function the name or part of the name can be typed in. Go need to be selected so the function will appear on the list. Choose the function from the list and then click on the OK button.

Second Step to Inserting a Function

Adding the Parameters

Parameters of the function need to be entered one by one. starting with the lookup value. Each that parameter that was chosen for the VLOOKUP is explained below. Lookup_value

For this function the lookup value is the average. This cell is found just to the left of the cell where the function (letter grade) is. The cell only needs to be click on or its reference number can be typed in. In the example cell I5 is chosen as the lookup value.

Table_array

The table array is the table that contains the data that is being looked up. The table array chosen is D15:I16. This range contains is basically the lookup table excluding the row headers.

Row_index_num

This is the row that displays data where the function is inputted. The row that references the lookup value is always going to be row 1 so the row index must be a number greater than 1. In the example 2 is the row index and the only row that can be chosen. If there was a third row that we wanted to return data for 3 could be used.

Range_lookup

The range lookup determines whether the lookup table searches row 1 for an exact match or an approximate match. This will be set to true when an approximate match is needed and set to false when an exact match is needed. In this case an approximate match needs to be used so true will be typed into this field.

An approximate match needs to be used because the grade averages are a continuous variable and therefore there will be a very low chance of an exact match. Using true, any grade from 50 to 59 will be an D. Grades from 60 to 69 will be a C and so on.

After each parameter is entered click the OK button.

Third Step to Inserting a Function

Remove Syntax Problem

The average grade was left blank on purpose to show that a syntax problem can occur. Since no grades occur at the beginning of the semester, this function will return an F or #NA because the average column will be left blank. And no teacher or student wants to see a big fat F or an Excel error. There are a few ways around this problem but I'm going to go the path with the least resistance by using the If statement. Just below is the standard HLOOKUP that returned an F when the was no value in the average cell. In some instances, an error will occur, but the If statement will clear the error that results due to a blank cell as well.

=HLOOKUP(I5,D15:I16,2,TRUE)

To ensure an F is not returned when there is no grade an if statement is used below.

=IF(I5=" ","NG",(HLOOKUP(I5,D15:I16,2,TRUE)))

Basically, the if statement is checking to see a space (" ") in the cell and if there is it returns NG meaning "no grade." If the statement does not detect a space in the cell the it defers to the HLOOKUP function.

Syntax Problem

Fix the Position of the Array

To utilize the fill handle to copy the HLOOKUP formula down to other records table array of the function needs to be fixed by adding dollar signs to the columns and rows of the table array. This can be completed by selecting the array and tapping the F4 key or the dollar signs can be keyed in.

Add Dollar Signs

Copy the Function

After the dollar signs are added the fill handle can be used to copy the function to other records.

Use the Fill Handle to Copy the Function

References

Rutkosky, N. H., Seguin, D., Davidson, J., Roggenkamp, A. R., & Rutkosky, I. (2014). Microsoft Excel 2013: Levels 1 & 2. St. Paul, MN: Paradigm Publishing.

Microsoft. (n.d.). Look up values with VLOOKUP, INDEX, or MATCH. Retrieved December 29, 2018, from https://support.microsoft.com/en-us/help/181213/how-to-use-vlookup-or-hlookup-to-find-an-exact-match

© 2019 James Smith

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)