What HLOOKUP does

HLOOKUP looks along the top row of a table for a value, then returns the value from a row below it in the same column. =HLOOKUP(B6,B1:D4,2,FALSE) finds the delivery service named in B6 across the top of a rate table and returns its fee from the table’s second row. The H stands for horizontal.

It works like VLOOKUP with the table turned sideways, for tables laid out across the sheet: months, quarters, price plans or services along the top, with their figures in the rows below. You give it what to find, the table, the number of the row to return and FALSE for an exact match.

HLOOKUP is in every version of Excel. In Microsoft 365 and Excel 2021 or later, XLOOKUP searches a row as easily as a column and has fewer ways to go wrong, so it’s the better choice for new workbooks that won’t be opened in older versions.

Syntax

=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
Arguments in square brackets are optional; the rest are required.
lookup_valueRequired
What to find in the top row of the table, such as the service name in B6.
table_arrayRequired
The whole table, starting with the row to search, such as B1:D4. HLOOKUP searches only its first row.
row_index_numRequired
Which row of the table to return, counting the table's top row as 1. 2 means the second row of the table, wherever the table starts on the sheet.
range_lookupOptional
FALSE for an exact match, which most lookups need. TRUE, or leaving it out, accepts the nearest value below when there's no exact match, and needs the top row sorted from smallest to largest.

Example: the fee for a delivery service

A courier’s rate card lists its three services across the top, with the base fee, the price per kg and the delivery time below. The service a customer picked is in B6.

HLOOKUP finds Express in C1, the second service, and returns the value from the table's second row, C2. In B7, =HLOOKUP(B6,B1:D4,2,FALSE) returns 9.90.

Read it as: find B6 in the top row of B1:D4, go down that column to the table’s second row, and return what’s there. Change the 2 to 4 and the same formula returns Express’s delivery time, 2 days.

Example: a discount from quantity bands

With TRUE as the last argument, HLOOKUP accepts the nearest value below when there’s no exact match, which suits bands. Here the top row holds the smallest order of each band, sorted from smallest to largest.

120 isn't in the top row, so HLOOKUP takes the largest value below it, 100, and returns that band's 5%. In B5, =HLOOKUP(B4,B1:D2,2,TRUE) returns 5%.

An order of 250 or more gets 8%, and anything from 0 to 99 units gets no discount. The first band starts at 0 so that every order finds a band; a value smaller than the first one in the top row gives #N/A.

HLOOKUP vs VLOOKUP vs XLOOKUP

VLOOKUP works the same way for tables laid out down the sheet: it searches the first column and returns a value from a column to the right, counted by number. Like HLOOKUP, it makes an approximate match unless you add FALSE, and it works in every version of Excel. XLOOKUP differs from both:

FeatureHLOOKUPXLOOKUP
SearchesThe top row of the tableAny row or column you select
Returns fromA row below, by its numberA range you select
Match when you leave the option outApproximate, so you add FALSEExact
Excel versionsEvery versionMicrosoft 365, Excel 2021 and later

On the rate card above, =XLOOKUP(B6,B1:D1,B2:D2) returns the same 9.90 as the HLOOKUP: it searches B1:D1 and returns from the row you select, so an inserted row can’t make it point at the wrong figure.

Common mistakes

  • Leaving out FALSE makes an approximate match, which assumes the top row is sorted. The service names aren’t in alphabetical order, so =HLOOKUP("Standard",B1:D4,2) returns 18, Overnight’s fee, with no error to warn you. End an exact lookup with FALSE.
  • The row number counts from the table’s top row, not the sheet’s. For a table in A5:D9, the sheet’s row 7 is row 3 of the table.
  • A row number larger than the table, as in =HLOOKUP(B6,B1:D4,5,FALSE), gives #REF!, and a number below 1 gives #VALUE!.
  • Insert a row inside the table and the figures move down, but the row number in the formula stays the same, so it returns a different row. Check the number after changing the table, or use XLOOKUP.
  • “Express ” with a space at the end doesn’t match “Express”, and the formula shows #N/A. Check the cell you’re looking up for stray spaces.

Frequently asked questions

What is the difference between HLOOKUP and VLOOKUP?

HLOOKUP searches the top row of a table and returns a value from a row below. VLOOKUP searches the first column and returns a value from a column to the right. Use the one that matches the way your table is laid out.

Should I use HLOOKUP or XLOOKUP?

In Microsoft 365 and Excel 2021 or later, XLOOKUP does the same job with an exact match by default and keeps working when rows are inserted. Keep HLOOKUP for workbooks that people open in Excel 2019 or earlier.

Why does HLOOKUP return #N/A?

It didn’t find the value in the top row. With FALSE, look for a stray space or a number stored as text on one side. With an approximate match, the value may be smaller than everything in the top row.

Can HLOOKUP use wildcards?

Yes, with FALSE and a text value: =HLOOKUP("Exp*",B1:D4,3,FALSE) finds the first service that starts with Exp. An asterisk stands for any characters and a question mark for one.

How do I use HLOOKUP with another sheet?

Point the table at the other sheet, as in =HLOOKUP(B6,Rates!B1:D4,2,FALSE). Click the other sheet’s tab while you type the formula and Excel adds the sheet name for you.