How to use HLOOKUP in Excel (and when XLOOKUP is better)

Type =HLOOKUP(value, table, row number, FALSE) to find a heading in the top row of a table and return the value from a row below it.

Read time
10 min
Word count
1.3K
Sections
11
FAQs
8
Share
Analyst pencilling notes on a wide printed spreadsheet beside a laptop showing Excel, under the title Use HLOOKUP in Excel
On this page · 11 sections
  1. HLOOKUP syntax
  2. Which Excel versions this covers
  3. Sample data: quarterly sales by region
  4. How to use HLOOKUP, step by step (exact match)
  5. HLOOKUP example with approximate match: discount bands
  6. HLOOKUP errors and fixes
  7. HLOOKUP vs VLOOKUP vs XLOOKUP
  8. When XLOOKUP is better than HLOOKUP
  9. For IT teams and businesses
  10. How eCorpIT can help
  11. References

Summary. To use HLOOKUP in Excel, type =HLOOKUP(lookup_value, table_array, row_index_num, FALSE). HLOOKUP searches the top row of a range for your value and returns the entry in the same column, a set number of rows down. In the sample table below, =HLOOKUP("Q3",$A$1:$E$4,3,FALSE) finds Q3 in row 1 and returns 40,100 from the third row. FALSE asks for an exact match; TRUE or a blank gives an approximate match, which needs the top row sorted in ascending order. A row number below 1 returns #VALUE!, one larger than the range returns #REF!, and a missing exact match returns #N/A. HLOOKUP is listed for Excel for Microsoft 365 on Windows and Mac and for Excel 2024, 2021, 2019 and 2016, with no restriction for Excel for the web. Microsoft now recommends XLOOKUP, which needs no row number and matches exactly by default, but XLOOKUP is not available in Excel 2016 or 2019.

About this article. For anyone whose headings run across the top of a sheet, such as budgets, forecasts and rate cards. We checked syntax, examples, errors, shortcuts and versions against Microsoft Support and Microsoft Learn on 15 November 2026, and recomputed every result. We are not affiliated with Microsoft. Researched with AI assistance and reviewed by our editorial team.

HLOOKUP syntax

Microsoft gives the syntax as HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]).

  • lookup_value (required): the value to find in the first row; a value, a cell reference or a text string.
  • table_array (required): the range or range name to search. HLOOKUP compares against its first row.
  • row_index_num (required): the row to return, where 1 is the top row of the range.
  • range_lookup (optional): FALSE for an exact match; TRUE or blank for an approximate match.

Uppercase and lowercase text are treated as the same.

Which Excel versions this covers

The steps work in Excel for Windows, Mac and the web. The newest releases on 15 November 2026 are Microsoft 365 Apps Current Channel Version 2610 (Build 20527.20196) and Office for Mac 16.115, both from 10 November 2026. Excel 2016 and 2019 reached end of support on 14 October 2025 and Excel 2021 retired on 13 October 2026; HLOOKUP still works there, without updates.

Sample data: quarterly sales by region

Type this into a blank sheet starting at cell A1:

Row A B C D E
1 Region Q1 Q2 Q3 Q4
2 North 42,000 45,500 47,250 51,000
3 South 38,400 36,900 40,100 43,800
4 West 29,750 31,200 33,600 35,900

How to use HLOOKUP, step by step (exact match)

  1. Click an empty cell, for example G1.
  1. Type =HLOOKUP(. After the opening bracket, Excel shows the syntax as hover text.
  1. Type "Q3" with the double quotes, or click a cell that contains Q3, then a comma. Without quotes, Excel reads Q3 as a reference to cell Q3 (column Q, row 3) and looks up whatever that cell holds.
  1. Select A1:E4 and press F4 to make it absolute ($A$1:$E$4) so it does not shift when copied. On a Mac, press Cmd+T or F4.
  1. Type ,3,FALSE) and press Enter.

            =HLOOKUP("Q3",$A$1:$E$4,3,FALSE)
          

The result is 40,100: Q3 is in column D, and row 3 of the range is South. Change the 3 to 2 for North (47,250) or 4 for West (33,600).

Let Excel find the row number. Nest MATCH inside HLOOKUP so the region name picks the row:


            =HLOOKUP("Q3",$A$1:$E$4,MATCH("South",$A$1:$A$4,0),FALSE)
          

MATCH with a match type of 0 returns the position of the exact match: 3, because South is the third cell in A1:A4. The formula again returns 40,100, and works in every version listed above.

From another sheet. Put the sheet name and an exclamation mark before the range, with apostrophes around a name that contains spaces or numbers. The rules match VLOOKUP between two sheets.


            =HLOOKUP("Q3",'Sales 2026'!$A$1:$E$4,3,FALSE)
          

HLOOKUP example with approximate match: discount bands

Approximate match suits a top row of thresholds rather than exact keys. Add this below the sales table:

Row A B C D E
7 Order value from 0 100 500 1,000
8 Discount 0% 5% 10% 15%

            =HLOOKUP(640,$B$7:$E$8,2,TRUE)
          

This returns 10%. HLOOKUP cannot find 640, so it uses the largest value in row 7 that is less than 640 (500) and returns the discount beneath it. An order of 1,000 returns 15%; an order of 80 returns 0%. Two rules apply:

  • Sort the top row in ascending order, left to right. Otherwise HLOOKUP may return the wrong band without any error.
  • Start the bands at the lowest possible value (0 here). A lookup value below the first threshold, such as -5, returns #N/A.

HLOOKUP errors and fixes

The causes below come from Microsoft's HLOOKUP, #N/A and #NAME? help pages.

What you see Cause Fix
#N/A No exact match for the lookup value in the top row (FALSE) Check spelling and stray spaces in the heading; TRIM removes leading and trailing spaces
#N/A Lookup value smaller than the first value in a sorted top row (TRUE) Add a starting band such as 0
Wrong value, no error TRUE or blank with an unsorted top row Sort the top row ascending, or use FALSE
#REF! Row number larger than the number of rows in the range Extend the range or lower the row number
#VALUE! Row number less than 1 Use 1 or higher
#NAME? Text such as a region name typed without double quotes, or a misspelt function name Add the quotes or correct the spelling

For genuine misses, wrap the formula in IFNA, which returns a value you choose instead of #N/A. With exact match on text, a question mark matches any single character, an asterisk any sequence, and a tilde before either finds the literal character.

HLOOKUP vs VLOOKUP vs XLOOKUP

This comparison draws on Microsoft's three function pages and its function list, which marks XLOOKUP as new in Excel 2021.

HLOOKUP VLOOKUP XLOOKUP
Searches Top row of the range Left-most column of the range Any single row or column you choose
Result position Row number Column number A separate return range
Default match Approximate (TRUE) Approximate (TRUE) Exact
Can return data above or to the left No No Yes
Built-in not-found result No (wrap in IFNA) No (wrap in IFNA) Yes, the if_not_found argument
Available in Microsoft 365, 2024, 2021, 2019, 2016, web Microsoft 365, 2024, 2021, 2019, 2016, web Microsoft 365, 2024, 2021, web (not 2016 or 2019)

Microsoft's lookup overview says that once you are comfortable with VLOOKUP, HLOOKUP takes the same arguments but searches rows instead of columns.

When XLOOKUP is better than HLOOKUP

Microsoft's HLOOKUP page opens with a tip recommending XLOOKUP, and the XLOOKUP page says it can replace HLOOKUP. The horizontal version of the sample lookup points at the header row and result row directly, with no row number, and returns 40,100:


            =XLOOKUP("Q3",B1:E1,B3:E3)
          

XLOOKUP is the better choice when:

  • Rows get inserted. Microsoft's XLOOKUP announcement names the fixed column number as a VLOOKUP weakness: insert or delete a column and you must edit the number by hand. HLOOKUP's row number has the same problem with rows; Microsoft says XLOOKUP has none of those limitations.
  • You need a two-way lookup. Nest one XLOOKUP inside another, as Microsoft's own example does. The first formula below returns 40,100.
  • You want a clean not-found result. The fourth argument, if_not_found, replaces IFNA.
  • The thresholds are not sorted. Match mode -1 returns an exact match or the next smaller item, and Microsoft's page mentions sorted data only for the binary search modes (2 and -2). The second formula returns 10%.

            =XLOOKUP("South",A2:A4,XLOOKUP("Q3",B1:E1,B2:E4))
=XLOOKUP(640,$B$7:$E$7,$B$8:$E$8,,-1)
          

Stick with HLOOKUP, or INDEX with MATCH, when the workbook must open in Excel 2016 or 2019, where XLOOKUP is not available. This INDEX and MATCH two-way lookup works in every version listed here and also returns 40,100:


            =INDEX($B$2:$E$4,MATCH("South",$A$2:$A$4,0),MATCH("Q3",$B$1:$E$1,0))
          

Microsoft has said HLOOKUP will stay supported. Our XLOOKUP guide covers match modes, search modes and multiple criteria.

For IT teams and businesses

Budgets, forecasts and rate cards often run months or price bands across the top, and that is where HLOOKUP breaks most: someone inserts a row for a new cost line and every hard-coded row number below it now points at the wrong line. In shared templates, use MATCH for row numbers, or XLOOKUP once every user has Microsoft 365, Excel 2021 or later, or the web version. Keep approximate-match rate tables sorted and lock their cells, and record which Excel versions each template must support.

How eCorpIT can help

eCorpIT is a Gurugram-based technology organisation, founded in 2021, assessed at CMMI Level 5 and MSME certified, with senior-led engineering teams working across AWS, Microsoft and Google platforms. Our data and analytics services team turns spreadsheet budgets and rate cards into governed reports that do not depend on hand-counted row numbers. Talk to us at /contact-us/.

Last updated: 15 November 2026.

References

  1. HLOOKUP function — Microsoft Support
  1. Excel functions (alphabetical) — Microsoft Support
  1. XLOOKUP function — Microsoft Support
  1. Update history for Microsoft 365 Apps (listed by date) — Microsoft Learn
  1. Update history for Office for Mac — Microsoft Learn
  1. Ending Support in 2025 — Microsoft Learn
  1. Ending Support in 2026 — Microsoft Learn
  1. How to correct a #NAME? error — Microsoft Support
  1. Overview of formulas in Excel — Microsoft Support
  1. Switch between relative, absolute, and mixed references — Microsoft Support
  1. Keyboard shortcuts in Excel (Windows and macOS tabs) — Microsoft Support
  1. MATCH function — Microsoft Support
  1. How to correct a #N/A error — Microsoft Support
  1. IFNA function — Microsoft Support
  1. VLOOKUP function — Microsoft Support
  1. Look up values with VLOOKUP, INDEX, or MATCH — Microsoft Support
  1. Announcing XLOOKUP, 28 August 2019 — Microsoft Tech Community (Excel Blog)
  1. INDEX function — Microsoft Support

Frequently asked

Quick answers.

01 How do I use HLOOKUP in Excel?
Type =HLOOKUP( followed by the value to find, the table range, the row number to return and FALSE for an exact match, then press Enter. For example, =HLOOKUP("Q3",$A$1:$E$4,3,FALSE) finds Q3 in the top row of A1:E4 and returns the value from the third row of that range.
02 What is the difference between HLOOKUP and VLOOKUP?
HLOOKUP searches across the top row of a table and returns a value from a row below, chosen by a row number. VLOOKUP searches down the left-most column and returns a value from a column to the right, chosen by a column number. Match options and error values work the same way.
03 What does row_index_num mean in HLOOKUP?
It is the row of the table range that holds the value you want back. Row 1 is the top row, the one HLOOKUP searches, row 2 is the next, and so on. A number below 1 returns #VALUE! and a number larger than the row count returns #REF!.
04 Why does HLOOKUP return the wrong value?
Usually because the last argument is TRUE or missing, so HLOOKUP performs an approximate match. If the top row is not sorted in ascending order, it can return a value from the wrong column without any error. Use FALSE for exact matches, or sort the top row when you need bands.
05 Can HLOOKUP look up a value from another sheet?
Yes. Put the sheet name and an exclamation mark before the range, such as =HLOOKUP("Q3",Sales!$A$1:$E$4,3,FALSE). If the sheet name contains spaces or numbers, wrap it in apostrophes, for example 'Sales 2026'!$A$1:$E$4. Everything else about the formula stays the same, including the row number.
06 Is HLOOKUP still supported in Excel?
Yes. Microsoft lists HLOOKUP for Excel for Microsoft 365 on Windows and Mac and for Excel 2024, 2021, 2019 and 2016, and it works in Excel for the web. Microsoft has said HLOOKUP will stay supported, although it recommends XLOOKUP for new formulas where available.
07 Should I use HLOOKUP or XLOOKUP?
Use XLOOKUP if everyone who opens the file has Microsoft 365, Excel 2021, Excel 2024 or Excel for the web. It needs no row number, matches exactly by default and copes better with inserted rows. Use HLOOKUP, or INDEX with MATCH, when the workbook must also work in Excel 2016 or Excel 2019.
08 Why does my HLOOKUP formula show #NAME?
Usually because text in the formula is missing its double quotes, such as a region name typed without them, or the function name is misspelt. Q3 without quotes does not cause this error: Excel treats it as a reference to cell Q3 and looks up whatever that cell contains.

About the author

Manu Shukla

Founder & Director

Founder of eCorpIT. Hands-on engineer leading senior-only delivery for AI apps, custom software, and cloud systems for global clients.

Subscribe

One engineering note a week. No fluff, no spam.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data, and marketing — delivered every Wednesday.

Past the reading

Read enough. Let's build something.

A senior architect responds in 24 working hours with scope, indicative cost, and a timeline. NDA before any technical conversation.

Loading search…

Browse all guides