How To Use The HLOOKUP Function In Excel (2026)
HLOOKUP searches the top row of a table for a value and returns a value from the same column in a row you choose.
The H stands for horizontal, so it is the function to reach for when your headings run across the top instead of down the side.
This guide covers the syntax, each argument, worked examples from Microsoft and the errors you are most likely to hit.
Table of Contents
- Quick answer: the HLOOKUP formula
- How HLOOKUP works
- The four arguments explained
- Exact match versus approximate match
- Sample data from Microsoft
- Worked examples
- Use wildcards in text lookups
- HLOOKUP errors and what they mean
- Which function should you use?
- Common mistakes to check first
- Handle missing values
- Return several rows from one heading
- Keep HLOOKUP fast on big sheets
- Official sources
- More Word, Excel and PowerPoint guides
Quick answer: the HLOOKUP formula
Type the formula below into any cell, replacing each part with your own cell references.
=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
| Part | What you enter |
|---|---|
| lookup_value | The value to find in the first row of the table |
| table_array | The range or named range that holds the table |
| row_index_num | Which row to return a value from, counted from 1 at the top of the table |
| range_lookup | FALSE for an exact match, TRUE or left out for an approximate match |
How HLOOKUP works
HLOOKUP looks across the first row of table_array until it finds lookup_value.
It then moves down that column to the row number you gave and returns the value it finds there.
Microsoft’s page recommends XLOOKUP for new work because it searches in any direction and returns exact matches by default.
HLOOKUP is still useful when you work in older workbooks or want the simpler horizontal layout.
The four arguments explained
The lookup_value can be a value, a cell reference or a text string.
The table_array can be a range reference or a range name, and its first row can hold text, numbers or logical values.
Uppercase and lowercase text are treated the same.
The row_index_num is 1 for the first row of the table, 2 for the second and so on.
The range_lookup argument is optional, and TRUE or leaving it out gives an approximate match.
Exact match versus approximate match
Use FALSE when you need the exact heading, and Excel does not require the first row to be sorted in that case.
With TRUE, the first row must be sorted in ascending order: numbers first, then text A to Z, then FALSE, then TRUE.
If the row is not sorted, an approximate match can return a wrong result.
When no exact match exists, an approximate lookup uses the largest value that is less than lookup_value.
| Setting | Behavior | Sorting needed |
|---|---|---|
| range_lookup FALSE | Only an exact match is returned | No |
| range_lookup TRUE or omitted | Uses the largest value less than lookup_value when no exact match exists | Yes, ascending, left to right |
Sample data from Microsoft
Paste this small table into cell A1 of a new worksheet to follow along.
| A | B | C | |
|---|---|---|---|
| Row 1 | Axles | Bearings | Bolts |
| Row 2 | 4 | 4 | 9 |
| Row 3 | 5 | 7 | 10 |
| Row 4 | 6 | 8 | 11 |
Worked examples
These formulas and results come from Microsoft’s HLOOKUP page.
| Formula | What it does | Result |
|---|---|---|
| =HLOOKUP(“Axles”, A1:C4, 2, TRUE) | Finds Axles in row 1 and returns row 2 of that column | 4 |
| =HLOOKUP(“Bearings”, A1:C4, 3, FALSE) | Finds Bearings and returns row 3 of that column | 7 |
| =HLOOKUP(“B”, A1:C4, 3, TRUE) | No exact match for B, so it uses the largest heading below B, which is Axles, and returns row 3 | 5 |
| =HLOOKUP(“Bolts”, A1:C4, 4) | Finds Bolts and returns row 4 of that column | 11 |
The third example shows why approximate matches surprise people, because a heading that does not exist still returns an answer.
Use wildcards in text lookups
When range_lookup is FALSE and lookup_value is text, you can use wildcards.
A question mark matches any single character, and an asterisk matches any sequence of characters.
To search for an actual question mark or asterisk, type a tilde before it.
HLOOKUP errors and what they mean
| Error | Cause |
|---|---|
| #VALUE! | row_index_num is less than 1 |
| #REF! | row_index_num is greater than the number of rows in table_array |
| #N/A | lookup_value is smaller than the smallest value in the first row, or no exact match exists when range_lookup is FALSE |
Our guide to fixing #N/A, #VALUE! and #REF! errors in Excel goes deeper on each one.
Which function should you use?
Microsoft’s lookup guide says to use HLOOKUP for a horizontal lookup, with either an exact or an approximate match.
For vertical data it points to VLOOKUP, or to INDEX combined with MATCH for an exact match.
Read how to use XLOOKUP and VLOOKUP in Excel if your data runs down columns.
Common mistakes to check first
Most wrong HLOOKUP results trace back to a short list of causes.
| Symptom | Likely cause | Fix |
|---|---|---|
| A wrong value comes back instead of an error | range_lookup was left out, so Excel used an approximate match | Add FALSE as the fourth argument |
| An approximate lookup returns odd results | The first row is not sorted ascending | Sort the headings left to right or switch to FALSE |
| #N/A on a heading that looks correct | No exact match exists, or the value is smaller than the smallest heading | Check the spelling and the cell contents |
| #REF! | row_index_num is larger than the table has rows | Count the rows inside table_array only, not the sheet |
Remember that row_index_num counts rows inside table_array, so row 1 is the top row of your selected table and not row 1 of the worksheet.
Handle missing values
Microsoft’s performance page shows wrapping a lookup in IFERROR to return a value you choose when nothing matches.
Its example uses VLOOKUP with FALSE and returns 0, in the form IFERROR(lookup formula, 0).
The same wrapper works around any lookup that can return #N/A, including HLOOKUP, and IFERROR is available in Excel 2007 and later.
Pick a result that makes sense for your sheet, such as 0 for numbers or a short text label.
Return several rows from one heading
Microsoft notes that since Office 365 version 1809, exact-match VLOOKUP, HLOOKUP and MATCH on unsorted data are much faster when you look up multiple columns from the same range.
In earlier versions, repeating many exact-match lookups on the same range remains a bottleneck.
A sheet with dozens of HLOOKUP formulas that all search the same top row is the pattern that slows down first.
Keep HLOOKUP fast on big sheets
Microsoft’s performance guidance says exact-match lookups scan cells until they find a match, so large ranges take longer.
It recommends keeping lookups and their data on the same worksheet and keeping the scanned range as short as you can.
A named range can make the table_array easier to read, as shown in our named ranges guide.
If a formula shows as text instead of a result, see why Excel formulas are not calculating.
Official sources
This guide is based on Microsoft’s HLOOKUP function page and its guide to looking up values in a list of data.
The speed advice comes from Microsoft’s Excel performance tips.