Spreadsheet Practice

HLOOKUP function

HLOOKUP is VLOOKUP turned sideways: it searches the top row of a table for a value and returns a value from a row below it, in the same column. Use it for tables laid out with labels across the top, such as months or quarters in columns. In Excel 2021 or later, XLOOKUP does the same job with less to go wrong.

Available in
Every current version
Category
Lookup functions
Returns
The value from the matching column, or #N/A when there is no match.
Google Sheets
Works the same way in Google Sheets.

Syntax

=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

ArgumentRequired?What it is
lookup_valueRequiredThe value to find in the top row of the table.
table_arrayRequiredThe table to search. The row you search must be its top row.
row_index_numRequiredWhich row of the table to return, counting the top row as 1.
range_lookupOptionalFALSE for an exact match. TRUE or left out for an approximate match, which needs the top row sorted smallest to largest.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
G2=HLOOKUP("Q2",A1:E3,2,FALSE)$135,000The Q2 target, from row 2 of the table
G3=HLOOKUP("Q3",A1:E3,3,FALSE)$149,000The Q3 actual, from row 3
G4=HLOOKUP("Q5",A1:E3,2,FALSE)#N/AThere is no Q5 column, so it returns the #N/A error

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
QuarterQ1Q2Q3Q4Result
Target$120,000$135,000$150,000$170,000$135,000
Actual$118,400$141,200$149,000$149,000
#N/A

Practice HLOOKUP

Graded instantly, then re-checked on changed data.

Sign-ups for a month

In B6, use HLOOKUP to return the sign-ups for the month in B5.

Common mistakes

What you seeWhy, and how to fix it
A wrong answer with no errorrange_lookup was left out, so HLOOKUP did an approximate match. Add FALSE as the fourth argument.
#REF!row_index_num is larger than the number of rows in table_array. Extend the range down or lower the number.
Results shift after inserting a rowrow_index_num doesn't move with the table. XLOOKUP and INDEX/MATCH reference the return row directly.

Tips

  • If you control the layout, store months down a column instead: most Excel tools, from filters to pivot tables, work better with data in columns.

Questions

What is the difference between VLOOKUP and HLOOKUP?

VLOOKUP searches down the first column and returns from a column to the right. HLOOKUP searches across the top row and returns from a row below.

What can I use instead of HLOOKUP?

XLOOKUP works across rows too: =XLOOKUP("Q2",B1:E1,B2:E2). In older versions, INDEX with MATCH on the header row does the same.

Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.