WorkbookLogic
FunctionLookup and referenceintermediateHLOOKUPIFROUND

HLOOKUP Function

By WorkbookLogic

The Excel HLOOKUP function searches the first row of a horizontal table and returns a value from another row in the same column. Its match mode should be specified explicitly.

ExcelLast reviewed Sep 11, 2026
hlookup-function-v1.0.0.xlsx
Excel HLOOKUP Function
Retrieve a value from a selected row by matching a key across the top row of a horizontal table.
Horizontal lookup table, editableHLOOKUP examples
Table rowColumn 1Column 2Column 3Column 4Column 5ExampleLookup valueRow indexFormula syntaxResult
HeaderJanFebMarAprMayRevenue for MarchMar2=HLOOKUP(I12,$B$12:$F$15,J12,FALSE)1450
Revenue1,2001,3501,4501,6001,750Cost for AprilApr3=HLOOKUP(I13,$B$12:$F$15,J13,FALSE)900
Cost7208108709001,050Margin for FebruaryFeb4=HLOOKUP(I14,$B$12:$F$15,J14,FALSE)40.0%
Margin40.0%40.0%40.0%43.8%40.0%
How to read the examples
HLOOKUP scans the top row from left to right.
FALSE requires an exact header match.
The row index selects which metric row is returned.
Reliability checks
March revenue returns the visible value 1,450OK
February margin returns the visible rate 40.0%OK

Overview

The Excel HLOOKUP function searches across the top row of a table and retrieves a value from another row in the matched column. It suits compact horizontal schedules where periods or bands are stored as column headers.

Quick reference

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

Returns: A value from the selected return row under the matched header or threshold. (any)

Arguments:

  • lookup_value (required) — The value to find in the first row of table_array.
  • table_array (required) — The horizontal table containing the lookup row and return rows.
  • row_index_num (required) — The one-based number of the return row within table_array.
  • range_lookup (optional) — FALSE or 0 requires an exact match; TRUE, 1, or omission uses approximate matching.

The bracketed range_lookup argument is optional and defaults to approximate matching. Use FALSE or 0 when the first row must contain an exact match.

Common uses

  • Retrieve Revenue, Cost, Margin, or another metric beneath a month header.
  • Return a value from a compact scenario or rate schedule.
  • Assign a level or bonus from horizontal ascending thresholds.
  • Read a stable cross-tab in which lookup keys occupy the top row.

Calculations

HLOOKUP scans the first row of table_array. After finding a matching column, it moves down that column to the row selected by row_index_num. The top lookup row is row 1, the row beneath it is row 2, and so on.

With FALSE, HLOOKUP requires an exact match and the header row does not need to be sorted. With TRUE or an omitted fourth argument, it uses approximate matching and returns the column associated with the largest top-row value less than or equal to the lookup value. Approximate matching requires ascending lookup values.

HLOOKUP is not case-sensitive, returns the first matching column when headers are duplicated, and supports text wildcards in exact-match mode.

Function behavior

Situation

Behavior

Exact match

FALSE or 0 requires equality and does not require sorted headers.

Approximate match

TRUE, 1, or omission requires an ascending top row and returns the next smaller threshold when needed.

Missing exact header

Returns #N/A.

Duplicate headers

Returns the first matching column.

Text case

Matching is not case-sensitive.

Wildcards

* and ? can match text in exact mode; ~ escapes a wildcard.

Invalid row index

Returns #REF! when the index exceeds the table height.

Inserted rows

A hardcoded row index can return a different metric if the table structure changes.

Common errors

Excluding the lookup row from table_array

What happens:
HLOOKUP searches the wrong first row and cannot find the intended header.

Better approach:
Make the lookup headers or thresholds the top row of table_array.

Omitting range_lookup

What happens:
HLOOKUP defaults to approximate matching and may return a plausible value for a missing header.

Better approach:
Use FALSE for month names, codes, and other exact keys.

Counting worksheet rows instead of table rows

What happens:
The wrong metric is returned or the formula produces #REF!.

Better approach:
Count from the top of table_array, where the lookup row is 1.

Using approximate match on unsorted values

What happens:
The result can be incorrect without producing an obvious error.

Better approach:
Sort the lookup row ascending or switch to exact match.

Example

Example 1 — Return March Revenue

=HLOOKUP(I12,$B$12:$F$15,J12,FALSE)

With Mar in I12 and row index 2, the workbook returns Revenue of 1,450.

Example 2 — Return April Cost

=HLOOKUP(I13,$B$12:$F$15,J13,FALSE)

The formula finds April in the top row and returns 900 from row 3 of the table.

Example 3 — Return February Margin

=HLOOKUP(I14,$B$12:$F$15,J14,FALSE)

The matched February column and row index 4 intersect at a Margin of 40.0%.

Example workbook

The workbook contains an HLOOKUP Example sheet with Jan–May headers and editable Revenue, Cost, and Margin rows. Three exact-match formulas retrieve March Revenue, April Cost, and February Margin, while two checks reconcile the visible intersections. A Notes sheet explains top-row keys, row indexes, and match modes.

Key takeaway

Put lookup keys in the table's top row, count return rows from that boundary, and use FALSE whenever an exact header match is required.