# HLOOKUP in Excel: Syntax, Examples and When to Use It
> Learn HLOOKUP in Excel: search the top row of a table and return a value from a row below it, with exact and approximate match, examples and fixes.

- Web page: https://logicexcel.com/functions/hlookup
- Language: en
- Also in: [Deutsch](https://logicexcel.com/de/functions/hlookup.md), [Español](https://logicexcel.com/es/functions/hlookup.md)
- Updated: 2026-11-03
- Practice this in the browser: https://logicexcel.com/practice/49

HLOOKUP searches the top row of a range for a value and returns a value from a row further down, in the same column. To get February's revenue, type `=HLOOKUP("Feb",A1:E4,2,FALSE)`. Excel scans A1:E1 for "Feb" and returns the entry from row 2 of that column. The `FALSE` asks for an exact match. Use HLOOKUP when your headings run across the sheet instead of down it.

This guide to HLOOKUP in Excel covers the syntax, seven worked examples on one monthly report, exact and approximate match, the row-number traps, how HLOOKUP compares with VLOOKUP, XLOOKUP and INDEX MATCH, and when to turn the table on its side instead. It also shows the mistakes learners make on our practice screens.

## TL;DR

- The pattern is `=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])`. It is VLOOKUP turned sideways.
- The value you search for must be in the first row of the range, and row_index_num counts rows from the top of that range.
- Type `FALSE` as the fourth argument for an exact match. Without it Excel does an approximate match on the top row, which can return the wrong column quietly.
- Row 1 of the range is the row you searched, so a row_index_num of 1 just returns the value you looked up.
- To look up a row by its label rather than a column by its heading, use MATCH to find the row number, or switch to XLOOKUP or INDEX MATCH.
- If you build the table yourself, a vertical layout is usually easier to work with.

## Table of Contents

- [The sample data used in every example](#the-sample-data-used-in-every-example)
- [HLOOKUP syntax and arguments](#hlookup-syntax-and-arguments)
- [HLOOKUP examples from simple to advanced](#hlookup-examples-from-simple-to-advanced)
- [Exact match or approximate match](#exact-match-or-approximate-match)
- [HLOOKUP vs VLOOKUP, XLOOKUP and INDEX MATCH](#hlookup-vs-vlookup-xlookup-and-index-match)
- [When a rotated table is the better choice](#when-a-rotated-table-is-the-better-choice)
- [Which Excel versions have HLOOKUP](#which-excel-versions-have-hlookup)
- [HLOOKUP errors and how to fix them](#hlookup-errors-and-how-to-fix-them)
- [What learners get wrong](#what-learners-get-wrong)
- [A worked job: a month picker for a report](#a-worked-job-a-month-picker-for-a-report)
- [Practice HLOOKUP](#practice-hlookup)
- [FAQ](#faq)
- [Sources](#sources)

## The sample data used in every example

You are preparing a short management report. The months run across row 1 and the measures run down column A, which is the layout HLOOKUP is built for. Type this into a blank sheet starting at A1.

| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Month | Jan | Feb | Mar | Apr |
| 2 | Revenue | 84000 | 91500 | 78200 | 96800 |
| 3 | Costs | 61000 | 64200 | 59800 | 66500 |
| 4 | Orders | 312 | 340 | 295 | 361 |

Cell G1 holds the heading "Month typed" and G2 holds the month you want to report on, here the text Feb.

Two more small tables appear later, one for rating bands and one with years across the top. Each is printed where it is used.

## HLOOKUP syntax and arguments

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

| Argument | Required | What it does |
|---|---|---|
| lookup_value | Yes | The value to find in the first row of the range. A cell, a number, or text in quotes. |
| table_array | Yes | The range that holds the top row to search and the rows to return from. |
| row_index_num | Yes | Which row of table_array to return. 1 is the top row of your range. |
| range_lookup | No | `FALSE` or `0` for an exact match. `TRUE`, `1` or left out for an approximate match. |

The logic mirrors VLOOKUP exactly, with rows and columns swapped. The search runs along the first row of the range. The row number counts down inside the range. If the range starts at row 5 instead of row 1, then row_index_num 1 means row 5 of the sheet.

HLOOKUP ignores upper and lower case, and it returns the first match if a heading appears twice. For text, an exact match also accepts the wildcards `*` and `?`.

## HLOOKUP examples from simple to advanced

Here is the HLOOKUP formula in action. Each example uses the monthly report above.

### How to look up one value across a row

You want March revenue. Revenue is the second row of the range, so the row number is 2.

`=HLOOKUP("Mar",A1:E4,2,FALSE)`

Excel finds "Mar" in D1 and returns the entry two rows down in that column, 78200.

### How to use a cell as the lookup value

Hardcoding "Mar" is fine for a test but a real report reads the month from a cell. With Feb in G2:

`=HLOOKUP(G2,A1:E4,3,FALSE)` returns 64200, the Feb costs.

`=HLOOKUP(G2,A1:E4,4,FALSE)` returns 340, the Feb orders.

Change G2 to Jan, Mar or Apr and every formula follows. The text typed in G2 must match the heading exactly, apart from capital letters.

### How to combine two HLOOKUPs

HLOOKUP returns a single value, so you can calculate with it like any other cell. February profit is revenue minus costs:

`=HLOOKUP(G2,A1:E4,2,FALSE)-HLOOKUP(G2,A1:E4,3,FALSE)`

That is 91500 minus 64200, which is 27300. If you build this often, put the two values in their own cells and subtract the cells, as in the job scenario below.

### What happens when the row number is 1

Row 1 of the range is the row Excel searches, so asking for it returns the heading you already have:

`=HLOOKUP(G2,A1:E4,1,FALSE)`

The result is "Feb". This looks pointless, but it is a handy test: if the formula returns the heading you typed, the match worked and any wrong number you get lies in the row number.

### How to find the row number with MATCH

Counting rows by hand breaks when someone inserts a row. Let MATCH find the row from its label:

`=HLOOKUP(G2,A1:E4,MATCH("Costs",A1:A4,0),FALSE)`

MATCH returns 3 because "Costs" is the third item in A1:A4, so the lookup returns 64200. Now you can reorder the rows and the formula still finds the right one. Our [MATCH guide](https://logicexcel.com/functions/match) explains the position-finding function.

### How to match part of a heading

An exact match on text accepts wildcards. A star stands for any run of characters:

`=HLOOKUP("Ma*",A1:E4,2,FALSE)`

The first heading that starts with "Ma" is "Mar", so this returns 78200. If two headings matched, such as March and May, you would get the first one from the left. Our [wildcard characters guide](https://logicexcel.com/functions/wildcard-characters) covers `*`, `?` and the tilde escape.

### How to use whole rows

You can point the lookup at entire rows when the table might grow. Whole rows 1 to 4 do the same job as A1:E4:

`=HLOOKUP("Feb",1:4,2,FALSE)`

That returns 91500. Be sure the first row holds the headings and nothing else in row 1 repeats them.

## Exact match or approximate match

The fourth argument decides whether HLOOKUP wants the value itself or just the nearest one below it.

**Exact match (`FALSE` or `0`)** returns `#N/A` when the heading is missing. Use it for months, codes, names and years.

**Approximate match (`TRUE`, `1` or omitted)** finds the largest heading that is less than or equal to your lookup value. The top row must be sorted from smallest to largest. Use it for bands, such as score ratings.

Here is a rating table in A1:E2. The bands start in B1, and the score to rate is in G2.

| Row | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | Score from | 0 | 60 | 80 | 90 | | Score |
| 2 | Rating | Poor | Fair | Good | Excellent | | 83 |

The formula searches B1:E2 only, so the label cells in column A are out of the way:

`=HLOOKUP(G2,B1:E2,2,TRUE)`

83 is not a heading, so Excel takes the largest heading that does not exceed it, which is 80, and returns "Good". A score of 59 returns "Poor" with `=HLOOKUP(59,B1:E2,2,TRUE)`, because the 0 band is the largest value at or below 59. Leaving off `TRUE` gives the same answer as approximate is the default. Switching to `FALSE` makes the same lookup fail:

`=HLOOKUP(G2,B1:E2,2,FALSE)` returns `#N/A`, because 83 is not listed.

The risk runs the other way on exact lookups. On the monthly report, leaving off the fourth argument turns a precise lookup into an approximate one on a top row that is not sorted, and the formula can land on a column you did not intend. Type `FALSE` every time you search for a name or a month.

## HLOOKUP vs VLOOKUP, XLOOKUP and INDEX MATCH

| Question | HLOOKUP | VLOOKUP | XLOOKUP | INDEX MATCH |
|---|---|---|---|---|
| Searches | The top row | The first column | Any row or column | Any row or column |
| Returns | A row number you count | A column number you count | A separate range, no counting | A separate range |
| Default match | Approximate | Approximate | Exact | Exact with 0 |
| Works in Excel 2019 | Yes | Yes | No | Yes |
| Finds a row by its label | Only with MATCH | Not applicable | Yes, by choosing the range | Yes |

For the same monthly lookup, the XLOOKUP version is shorter and needs no row count. It returns February revenue with:

`=XLOOKUP(G2,B1:E1,B2:E2)`

That gives 91500. And to find the Feb costs by label with INDEX and MATCH:

`=INDEX(B2:E4,MATCH("Costs",A2:A4,0),MATCH(G2,B1:E1,0))`

This returns 64200. It is longer, but it works in any Excel version and can find a row by its label on one line. Our [INDEX MATCH guide](https://logicexcel.com/functions/index-match) and [XLOOKUP guide](https://logicexcel.com/functions/xlookup) walk through both. If the table is vertical, the tool you want is [VLOOKUP](https://logicexcel.com/functions/vlookup).

## When a rotated table is the better choice

HLOOKUP exists because some tables arrive sideways: financial statements with months across, timetables, export files with one column per date. Most other business data is vertical, with one record per row. If you are building a new sheet, turn it so the headings run down.

If you inherit a horizontal table and want to work with it as a vertical one, copy the whole range, right-click the destination, choose Paste Special and tick Transpose. Excel swaps rows and columns. The TRANSPOSE function does the same live, so the rotated copy updates when the source changes.

A rotated table also lets you use the more familiar tools: VLOOKUP, FILTER, a pivot table, or a table with filters. A horizontal layout makes pivot tables and filters awkward.

Keep HLOOKUP when the layout is fixed and someone else owns it, or when the headings really are a short fixed list across the top, such as a bands table.

## Which Excel versions have HLOOKUP

HLOOKUP is in every desktop version of Excel, in Excel for Microsoft 365, in Excel for the web and in Excel for Mac. A workbook that uses it opens and calculates correctly in older versions, unlike one that uses XLOOKUP, which needs Microsoft 365 or Excel 2021 and later. That compatibility is the strongest reason to keep using it in shared files.

## HLOOKUP errors and how to fix them

Each error below can be reproduced on the monthly report.

| Error | Cause | Fix |
|---|---|---|
| `#N/A` | The lookup value is not in the top row, as in `=HLOOKUP("Costs",A1:E4,2,FALSE)` or a missing month. A text number against a real number also fails. | Search for a heading, not a row label. Check spelling, spaces and data types. |
| `#REF!` | row_index_num is bigger than the number of rows in the range, as in `=HLOOKUP(G2,A1:E4,5,FALSE)`. | Use a row number inside the range, or widen the range. |
| `#VALUE!` | row_index_num is below 1, as in `=HLOOKUP(G2,A1:E4,0,FALSE)`. | Use 1 or higher. |
| `#NAME?` | Text typed without quotes, or the function name misspelled. | Put the text in quotes or use a cell. |
| A wrong number, no error | The fourth argument was left off, or the row number is off by one. | Type `FALSE`. Return the heading with row 1 as a test. |

The text-versus-number case appears when the headings are years. Here years run across the top and branches run down.

| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Year | 2023 | 2024 | 2025 |
| 2 | Cape Town | 410 | 455 | 480 |
| 3 | Durban | 380 | 395 | 430 |

`=HLOOKUP(2024,A1:D3,3,FALSE)` returns 395, the Durban figure for 2024. The same formula with the year in quotes fails:

`=HLOOKUP("2024",A1:D3,3,FALSE)` returns `#N/A`, because the quoted "2024" is text and the heading is a number.

Searching for a branch name also fails, because branch names live in column A and not in the top row:

`=HLOOKUP("Durban",A1:D3,3,FALSE)` returns `#N/A`. To find Durban's 2024 figure you search for the year in the top row and return the Durban row, which is what the first formula does.

## What learners get wrong

Between 26 September and 3 November 2026, learners made 3,498 first attempts across our [HLOOKUP Function lesson](https://logicexcel.com/practice/49), and 69.8% were right. [HLOOKUP Function 2](https://logicexcel.com/practice/72) logged 1,904 first attempts, with 74.4% right. A first attempt is the first check of a screen in a page view, not a head count of people. Four patterns explain most of the wrong answers.

**1. The row number is one off.** On the screen asking for the year Reagan was elected, 58.3% of 355 first attempts were right. The wrong answer `=hlookup("Reagan",a1:g3,3,false)` appeared 11 times: row 3 where row 2 holds the year. On the Wisconsin 2021 sales screen, only 53.0% of 202 first attempts were right, and both `=hlookup(2021,1:5,4,false)` and `=hlookup(2021,1:5,2,false)` appeared 5 times, one row too far and one row too short. Count the rows inside the range, starting with the headings as row 1, or use MATCH to find the row from its label.

**2. Searching for something that is not in the top row.** On that Wisconsin screen, `=hlookup("Wisconsin",1:5,3,false)` was typed 10 times and the `0` version 6 more. Wisconsin is a row label, and HLOOKUP only searches the top row. The years run across, so the working formula searches for the year: `=hlookup(2021,1:5,3,false)`. The same mix-up appeared as `=hlookup("Ohio",1:5,5,false)`. Ask which values sit across the top before you write the formula.

**3. Typos in the lookup text.** On the Reagan screen, `"Reagen"` was typed 8 times, `"Reagon"` 4 times and `"Regan"` 4 times. A further 5 attempts left out the comma, as in `=hlookup("Reagan"a1:g3,2,false)`. An exact match needs the exact spelling. Click the cell that holds the heading instead of retyping it where you can.

**4. Row 1 and the wrong kind of answer.** One prediction screen asked what `=HLOOKUP(2024, 1:5, 1, FALSE)` returns. The answer is 2024, because row 1 is the heading row you searched. Only 61.3% of 199 first attempts were right, and the wrong answers were labels from the table, "newyork" 10 times and "state" 6 times, instead of the value the formula returns. Another screen's accepted answer was the plain number 8, yet the most common wrong answer, 110 times, was the typed formula `=hlookup("Clinton",a1:g3,3,false)`. Read whether a screen wants a formula or the value that a formula returns.

## A worked job: a month picker for a report

Your manager wants a small panel on the monthly report: pick a month, see revenue, costs, profit and margin. Use the sheet from the top of this page.

1. **Add a month picker.** Put the months Jan, Feb, Mar and Apr in a drop-down in G2. Our guide to [creating a drop-down list](https://logicexcel.com/functions/create-drop-down-list) shows how, and it stops typos that would break an exact match.
2. **Pull revenue and costs.** In I2 write `=HLOOKUP(G2,A1:E4,MATCH("Revenue",A1:A4,0),FALSE)` for revenue and in J2 `=HLOOKUP(G2,A1:E4,MATCH("Costs",A1:A4,0),FALSE)` for costs. With Feb selected they return 91500 and 64200. MATCH finds each row from its label, so reordering the table cannot shift the answers.
3. **Work out profit and margin.** In K2 write `=I2-J2`, which gives 27300. In L2 write `=K2/I2`, which gives about 0.2984 and shows as 29.8% when formatted as a percentage.
4. **Test a bad pick.** Type a month that is not in the table, like May. Both lookups return `#N/A`, which is the correct signal. If you want a friendlier message, wrap each lookup in IFNA with your own text, so a missing month reads "Not in report" and an actual error elsewhere stays visible.

If the manager adds a column for May, widen the range to include it, or use whole rows so the range never needs editing.

## Practice HLOOKUP

Typing the formula teaches this faster than reading about it. The page already carries an exercise from [Practice Lesson 49](https://logicexcel.com/practice/49), so type the formula there rather than read on.

Then continue with [Practice Lesson 72](https://logicexcel.com/practice/72), where the table has years across the top and states down the side and you choose both the lookup value and the row number. If a formula fails, compare it against the four patterns above before you retry. For the vertical version of everything on this page, see the [VLOOKUP guide](https://logicexcel.com/functions/vlookup).

## FAQ

### What does HLOOKUP do in Excel?

HLOOKUP searches the first row of a range for a value and returns a value from a row below it in the same column. The H stands for horizontal. For example, `=HLOOKUP("Feb",A1:E4,2,FALSE)` finds Feb in the top row and returns the Feb entry from row 2 of the range.

### What is the difference between HLOOKUP and VLOOKUP?

The difference is direction. VLOOKUP searches down the first column and returns from a column you number. HLOOKUP searches across the first row and returns from a row you number. Everything else works the same way, including the exact and approximate match settings and the errors you get.

### Why does HLOOKUP return #N/A?

The lookup value is not in the top row of the range. Common reasons are searching for a row label instead of a heading, a typo or extra space, a number against text such as "2024" versus 2024, or an approximate match with a value below the first heading. Check which values actually sit in the top row.

### What does the 4th argument in HLOOKUP mean?

The fourth argument, range_lookup, chooses the match type. `FALSE` or `0` demands an exact match and returns `#N/A` if the heading is missing. `TRUE`, `1` or blank looks for the nearest heading not above your value and needs the top row sorted from smallest to largest. For names and months, use `FALSE`.

### Can HLOOKUP look up a row instead of a column?

Not directly, because it only searches the top row. To look something up by its row label, use MATCH to find the row number and pass it to HLOOKUP, or use XLOOKUP or INDEX with MATCH, which can search any row or column. Turning the table on its side also lets VLOOKUP do it.

### Is HLOOKUP still worth learning?

Yes, if you work with files other people built. Plenty of financial reports and exports keep headings across the top, and they use HLOOKUP. For new work in a current Excel, XLOOKUP is shorter and avoids the row count, but HLOOKUP still runs in every version and teaches the same lookup logic.

## Sources

- [HLOOKUP function, Microsoft Support](https://support.microsoft.com/en-us/office/hlookup-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f)
- [XLOOKUP function, Microsoft Support](https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929)
