How to use HLOOKUP in Excel
HLOOKUP is VLOOKUP turned sideways: it searches the first row of a table and returns a value from a row below. Use it when the data runs across, like months or quarters in columns.
Syntax
=HLOOKUP(lookup_value, table_array, row_index_num, FALSE)
lookup_value | What to look for in the first row. |
table_array | The table, starting with the header row. |
row_index_num | Which row to return: 1 = header row, 2 = the next… |
range_lookup | FALSE for an exact match. |
Examples
=HLOOKUP("Q3", B1:E3, 2, FALSE)Sales for Q3 from a quarterly table.=HLOOKUP(B5, $B$1:$M$4, 3, FALSE)Costs for the month in B5.Look up a month in a report row
HLOOKUP searches the first row of a table and returns a value from a row below it. It fits reports where the months or quarters run across the top.
=HLOOKUP("Mar", $B$1:$M$5, 3, FALSE)The March value from the 3rd row of the table.=HLOOKUP(P1, $B$1:$M$5, MATCH(P2, $A$1:$A$5, 0), FALSE)Month in P1, line item in P2: MATCH picks the row so you don't count rows by hand.HLOOKUP vs XLOOKUP across
XLOOKUP works horizontally too: point it at the header row and the row to return. There's no row number to break when someone inserts a row.
=HLOOKUP(P1, $B$1:$M$5, 3, FALSE)The classic way.=XLOOKUP(P1, $B$1:$M$1, $B$3:$M$3)The same with XLOOKUP, in Microsoft 365 and Excel 2021.Common mistakes
- Same pitfalls as VLOOKUP
- Missing FALSE, values not found, rows that shift when you insert one.
- Modern alternative
- XLOOKUP works both vertically and horizontally.
Frequently asked questions
What's the difference between VLOOKUP and HLOOKUP?
VLOOKUP searches down the first column, HLOOKUP across the first row. Everything else, including the FALSE at the end, works the same.
Why does HLOOKUP return the wrong value?
The last argument is missing, so HLOOKUP does an approximate match. Always end with FALSE. The same trap is shown step by step in VLOOKUP vs XLOOKUP.
Why does HLOOKUP return #REF!?
The row number is larger than the number of rows in the table: asking for row 6 of a 5-row table.
Available in: All versions of Excel, Excel for the web, Google Sheets