Skip to content

Look across a row with HLOOKUP

Lookups in any direction7 minPremium

Builds on Look up a value with VLOOKUP.

A sales rep at a software reseller in Dublin quotes from a price sheet that lists the plans across the top, with the monthly fee, the number of users and the storage in the rows below. Customers ask about one plan at a time.

How it works

HLOOKUP is VLOOKUP turned on its side, and the H stands for horizontal. It looks along the top row of a table, from left to right, for the value you give it, then goes down that column to the row you name by its number.

RowABC
1ArgumentWhat it isExample
2lookup valuewhat to find in the top rowB6
3table arraythe whole table, starting with the row to searchB1:D4
4row index numwhich row of the table to return; its top row is 14
5range lookupFALSE for an exact matchFALSE

Sideways tables turn up wherever months, quarters or plans run across a report. HLOOKUP reads them as they are, so nobody has to turn the table around first. The row number counts from the table's own top row, wherever the table starts on the sheet.

Example

A quarterly report has the quarters so far across B1:D1 and its figures below them: orders in row 2, returns in row 3 and revenue in row 4. The quarter to report on is in B6.

=HLOOKUP(B6,B1:D4,4,FALSE)
Finds the quarter in B6 along the top row of B1:D4 and returns the value from the table's 4th row, the revenue.

  1. Step 1: HLOOKUP takes the quarter in B6, Q3.
  2. Step 2: It looks along the top row of B1:D4 and finds Q3 in D1.
  3. Step 3: It goes down that column to the table's 4th row, D4.
  4. Step 4: B7 shows that revenue, $61,940.
HLOOKUP looks along the top row for the quarter, then down that column to the row you asked for. In B7, =HLOOKUP(B6,B1:D4,4,FALSE) returns $61,940.

Common mistakes

  • =HLOOKUP(B6,B1:D4,4) leaves out FALSE and makes an approximate match, which assumes the top row is sorted. Labels such as Jan, Feb and Mar aren't in alphabetical order, so it can return another column's figure with no error.
  • The row number counts from the table's top row, not the sheet's. For a table in A3:D8, row 5 of the sheet is row 3 of the table.
  • A table that doesn't reach the row you ask for shows #REF!. Make the table tall enough to include it.

In short

  • =HLOOKUP(what, table, row number, FALSE) searches the top row and returns from a row below.
  • Count the row number from the table's own top row, which is 1.
  • End with FALSE for an exact match, as with VLOOKUP.
  • XLOOKUP (Excel 2021 and later) and INDEX with MATCH (any version) can search along a row too.

Practice

Premium

4 exercises: 3 formulas and 1 quiz question.

Practice is part of Premium

Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.