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.
| Row | A | B | C |
|---|---|---|---|
| 1 | Argument | What it is | Example |
| 2 | lookup value | what to find in the top row | B6 |
| 3 | table array | the whole table, starting with the row to search | B1:D4 |
| 4 | row index num | which row of the table to return; its top row is 1 | 4 |
| 5 | range lookup | FALSE for an exact match | FALSE |
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)- Step 1: HLOOKUP takes the quarter in
B6, Q3. - Step 2: It looks along the top row of
B1:D4and finds Q3 in D1. - Step 3: It goes down that column to the table's 4th row, D4.
- Step 4: B7 shows that revenue, $61,940.
Common mistakes
=HLOOKUP(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.B6, B1:D4, 4) - 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(searches the top row and returns from a row below.what, table, row number, FALSE) - 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
Premium4 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.
Have one? Sign in