LocalExcelTool
Get started

Excel HLOOKUP function

HLOOKUP is the horizontal VLOOKUP: find the key in the first row, return a value N rows down the same column. It suits reports with headers across the top — quarters in B1:D1, metrics down the side. In most cases transposing the table and using XLOOKUP is more maintainable, because adding a row to a sideways table shifts every row number.

Lookup & reference · Available in: Excel 97 and every desktop version since

Syntax

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

What it returns The value in row N of the matched column; #N/A when nothing matches.

Arguments
lookup_valuerequiredThe value to find in the first row of the table.
table_arrayrequiredThe range to search; the key must be in its first row.
row_index_numrequiredWhich row of the range to return, counting from 1.
range_lookupoptionalFALSE for exact; TRUE or omitted for approximate, which needs the first row sorted ascending.

Examples

One quarter's revenue from a sideways header

MetricQ1Q2Q3
Revenue120000138000151000
Cost740008100088000
= HLOOKUP("Q2",A1:D3,2,FALSE)

→ 138000

Q2 sits in the third column of A1:D1, and row index 2 returns the second row of that column — 138000. The key row must be the range's first row, or nothing matches.

Common mistakes

  • 1.A title row above the headers. HLOOKUP only searches the first row of table_array, so one extra row on top breaks everything.
  • 2.Adding a column without updating row_index_num — and deleting one has the same effect. Sideways tables hit this more often because quarters keep being appended.
  • 3.Forcing HLOOKUP onto data that should be transposed. TRANSPOSE it once and use XLOOKUP: clearer to read, harder to break.

How to use it

  1. 1.Click the cell where the result should appear.
  2. 2.Type = then the function name, and press Tab to accept it.
  3. 3.Enter each argument separated by commas; ranges can be dragged with the mouse.
  4. 4.Press Enter. Drag the fill handle down if the same formula applies to more rows.

Frequently asked questions

What is the syntax of HLOOKUP?

HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]). What it returns: The value in row N of the matched column; #N/A when nothing matches.

Which Excel versions support HLOOKUP?

Excel 97 and every desktop version since. It is available in every desktop version unless the note above says otherwise.

Why does HLOOKUP return an error instead of a value?

A title row above the headers. HLOOKUP only searches the first row of table_array, so one extra row on top breaks everything.

Related functions

More in this group

Need to get the data in first?

← All Excel formulas