Quick Answer

HLOOKUP Function

Looks up a value across rows (horizontal search).

✓ Excel✓ Google SheetsExcel All versions

Syntax

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

Parameters

ParameterDescriptionRequired
lookup_valueThe value to find in the first row of the table.Required
table_arrayThe range containing the data; the first row is searched.Required
row_index_numThe row number within the table (1-based) from which to return a value.Required
range_lookupTRUE for an approximate match (first row sorted ascending), FALSE for an exact match. Defaults to TRUE.Optional

Basic Example

Find quarterly sales

=HLOOKUP("Q2",A1:E5,3,FALSE)
ResultValue from row 3 of the matched column

HLOOKUP finds "Q2" in row 1, then returns the value in row 3 of that column.

Advanced Examples

Example 1: Exact match lookup

Product codes across the top row, data beneath

Return the price row

=HLOOKUP("X100",A1:G4,4,FALSE)
Result: Price for X100
With FALSE, only an exact code match returns the row 4 value.

Example 2: Approximate match (sorted)

First row holds sorted thresholds

Find the bracket containing a score

=HLOOKUP(85,A1:E2,2,TRUE)
Result: Bracket label for 85
With TRUE it finds the largest threshold not exceeding 85 in the sorted first row.

How HLOOKUP Works

HLOOKUP scans the first row of table_array for lookup_value. With range_lookup FALSE it requires an exact match; with TRUE it finds the closest value less than or equal to the lookup in an ascending first row, then returns the corresponding value from row_index_num.

1
Prepare the table
Put search keys in the first row and data below.
2
Set the row index
Count which row (from the top) to return.
3
Choose match type
Use FALSE for exact, TRUE for approximate on sorted data.

Important Notes & Limitations

  • Looks only downward within the matched column; it cannot return values from rows above the match row.

  • Approximate matching (TRUE) requires the first row sorted ascending or results are wrong.

  • Hard-codes the row position, so inserting rows breaks row_index_num. XLOOKUP avoids this fragility.

Common Errors & Fixes

#N/A errorlookup_value is not found (exact match) or data is unsorted for approximate match.

Fix: Verify the key exists, or sort the first row ascending for TRUE.

#REF! errorrow_index_num is greater than the number of rows in table_array.

Fix: Reduce row_index_num to a valid row.

Download Practice File

Practice HLOOKUP with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the HLOOKUP function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

HLOOKUP vs VLOOKUP?
HLOOKUP searches horizontally across the first row; VLOOKUP searches vertically down the first column.
Why do I get #N/A?
Usually the key isn't found for an exact match, or the first row isn't sorted for an approximate match.
Is there a better alternative?
XLOOKUP (Microsoft 365) is more flexible and avoids the row-index fragility.