HLOOKUP ("horizontal lookup") searches across the top row of a range for a key and returns a value from another row in the same column. It is the sideways version of VLOOKUP, useful when your table has labels across the top, such as months, years, or product names as column headers, rather than down the left side.
Syntax
=HLOOKUP(search_key, range, index, [is_sorted])
search_key: The value to look for in the first row ofrange.range: The table to search. The row holding the key must be the top row of this range.index: The row number withinrangeto return a value from.1is the key row itself,2is the row below, and so on.is_sorted[Optional]:TRUE(the default) means approximate match and requires the first row to be sorted ascending.FALSEmeans exact match. UseFALSEunless you want an approximate match.
Quick example
Suppose A1:D3 holds quarterly sales by region:
A B C D
1 Region Q1 Q2 Q3
2 North 120 135 150
3 South 90 110 95
The quarters are in the top row. To get the North value for Q2, search the top row for Q2 and return the 2nd row of the range:
=HLOOKUP("Q2", A1:D3, 2, FALSE)
Result: 135. HLOOKUP finds Q2 in the top row (column C) and returns the cell in the 2nd row of the range in that same column.
To pick the row by name as well, combine it with MATCH:
=HLOOKUP("Q2", A1:D3, MATCH("South", A1:A3, 0), FALSE)
Result: 110. MATCH finds that South is the 3rd row, and HLOOKUP uses that as the row index.
Exact vs. approximate match
As with VLOOKUP, the fourth argument matters.
FALSEreturns the first column whose top cell equals the key. If there is none you get#N/A. It is case-insensitive and supports wildcards (*,?).TRUEor omitted returns the column with the largest top value that is less than or equal to the key, and requires the top row to be sorted ascending. If it is not, the result is unpredictable and Sheets does not warn you.
Approximate match suits bands, for example a discount table laid out horizontally:
A B C D
1 Order size 0 100 500
2 Discount 0% 5% 10%
=HLOOKUP(250, A1:D2, 2, TRUE)
Result: 5%. 250 falls between 100 and 500, so it uses the 100 column.
Common errors
#N/A. The key is not in the top row. Check for trailing spaces (useTRIM) and for text versus numbers, since"2026"and2026do not match.#REF!.indexis larger than the number of rows in the range. A range ofA1:D3has three rows, soindexcan be at most3.- Wrong value, no error. You left out
FALSEand Sheets used an approximate match on an unsorted row.
When not to use HLOOKUP
HLOOKUP has the same limits as VLOOKUP, turned sideways: it can only return rows below the key row, and the hard-coded row number breaks if you insert a row. For flexible lookups, prefer XLOOKUP, which works in any direction, or INDEX/MATCH.
If your data is laid out vertically, use VLOOKUP. If you control the layout, vertical tables (one record per row) are easier to filter, sort and query than horizontal ones.
Frequently asked questions
What is the difference between HLOOKUP and VLOOKUP? VLOOKUP searches down the first column and returns from another column. HLOOKUP searches across the first row and returns from another row.
Can HLOOKUP return several rows? Pass an array as the index and wrap the formula in ARRAYFORMULA: =ARRAYFORMULA(HLOOKUP("Q2", A1:D3, {2, 3}, FALSE)) returns the values from rows 2 and 3.
Can I use HLOOKUP on another sheet? Yes: =HLOOKUP("Q2", Sales!A1:D3, 2, FALSE).
Related Functions
VLOOKUP: Vertical lookup down the first column.XLOOKUP: A modern lookup that works in any direction.INDEX: Returns a cell by row and column position.MATCH: Finds the position of a value in a range.