ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Comparisons
  3. HLOOKUP vs XLOOKUP: Horizontal Lookups Compared

HLOOKUP vs XLOOKUP: Horizontal Lookups Compared

By ExcelReady Team·Updated November 2, 2026·8 min read

The short answer

Both look up values in a sideways table. HLOOKUP searches the top row and returns a value from a row number you count. XLOOKUP searches any row and returns from any other row, matches exactly by default and survives inserted rows. Use XLOOKUP in Excel 2021 or Microsoft 365, and HLOOKUP when older Excel must open the file.

Key takeaways

  • HLOOKUP only searches the top row of its table and returns from a row below it, counted by number.
  • XLOOKUP searches any row and returns from any row, including a row above the one it searched.
  • HLOOKUP defaults to an approximate match, so add FALSE for exact codes. XLOOKUP is exact by default.
  • Inserting a row inside the table breaks an HLOOKUP row number, but XLOOKUP's ranges adjust on their own.
  • XLOOKUP needs Excel 2021, Excel 2024 or Microsoft 365. HLOOKUP works in every version.
On this page+
  1. HLOOKUP vs XLOOKUP at a glance
  2. How the syntax differs
  3. The same lookup, side by side
  4. Approximate matches: tiers and bands
  5. When to use HLOOKUP
  6. When to use XLOOKUP
  7. Common mistakes with HLOOKUP and XLOOKUP
  8. Our recommendation
  9. Practise it

The short answer to HLOOKUP vs XLOOKUP: both find a value in a table that runs sideways, with labels across the top instead of down the side. HLOOKUP searches only the top row and needs you to count which row to return. XLOOKUP searches any row, returns from any row and matches exactly unless you tell it otherwise. This guide is for anyone who meets horizontal rate cards, monthly budgets or price grids at work or in an Excel test.

HLOOKUP vs XLOOKUP at a glance#

XLOOKUP can do everything HLOOKUP does, with fewer ways to go wrong, but it needs a newer version of Excel.

FeatureHLOOKUPXLOOKUP
Syntax=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Row it searchesOnly the top row of the tableAny row you choose
Row it returns fromA row below, given as a numberAny row, given as a range
Default matchApproximate (TRUE)Exact
Value not found#N/A#N/A, or your own message
Inserting a row in the tableCan break the row numberRanges adjust
Approximate matchTop row must be sorted ascendingWorks on unsorted data
Search from the last columnNoYes (search_mode -1)
Wildcards (*, ?)Yes, with FALSEYes, with match_mode 2
Excel versionsAll versionsExcel 2021, Excel 2024, Microsoft 365, Excel for the web

How the syntax differs#

HLOOKUP takes one block of cells and a row number. XLOOKUP takes two separate rows: one to search and one to return.

Excel formula
=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value is what you want to find, such as a product code.
  • table_array (HLOOKUP) is the whole table. HLOOKUP always searches its first row.
  • row_index_num (HLOOKUP) is the row to return, counted from the top of the table. The top row is 1.
  • range_lookup (HLOOKUP) is FALSE for an exact match. If you leave it out, HLOOKUP uses TRUE, an approximate match.
  • lookup_array and return_array (XLOOKUP) are two rows of the same width. XLOOKUP finds the value in the first and returns the cell in the same column of the second.

HLOOKUP is the sideways twin of VLOOKUP, so most of the points in VLOOKUP vs XLOOKUP apply here too, turned on their side.

The same lookup, side by side#

Here is a small product card where each product is a column:

ABCDE
1CodeP-100P-200P-300P-400
2ItemDeskChairLampShelf
3Price2408532120
4Stock124007

Task 1: find the price of P-300#

Both formulas return 32:

Excel formula
=HLOOKUP("P-300",A1:E4,3,FALSE)
=XLOOKUP("P-300",B1:E1,B3:E3)

In HLOOKUP, the 3 means "the third row of A1:E4", which is Price. In XLOOKUP, you point straight at the Price row, B3:E3, so there is nothing to count.

Task 2: find the code for the Lamp#

Now the item name is known and the code is wanted. The code is in row 1, above the row you search. HLOOKUP can't do this: it only searches the top row and only returns rows below it. XLOOKUP doesn't care about direction:

Excel formula
=XLOOKUP("Lamp",B2:E2,B1:E1)

The result is P-300. In older Excel, the same job needs INDEX and MATCH: =INDEX(B1:E1,MATCH("Lamp",B2:E2,0)). The comparison of INDEX MATCH vs XLOOKUP explains that pattern.

Task 3: a code that doesn't exist#

Search for P-500 and HLOOKUP returns #N/A. XLOOKUP lets you write the message in the fourth argument:

Excel formula
=XLOOKUP("P-500",B1:E1,B3:E3,"No such code")

The result is the text No such code. With HLOOKUP, wrap it in IFNA to get the same effect: =IFNA(HLOOKUP("P-500",A1:E4,3,FALSE),"No such code").

Task 4: return a whole column#

XLOOKUP can return more than one cell. Give it a return range several rows deep:

Excel formula
=XLOOKUP("P-200",B1:E1,B2:E4)

This spills three results down the column: Chair, 85 and 40. HLOOKUP returns one cell per formula, so you would need three formulas with row numbers 2, 3 and 4.

Approximate matches: tiers and bands#

Both functions can find the right band in a tier table, but HLOOKUP needs the top row sorted from smallest to largest. Here is a discount table:

ABCDE
7Order from01005001000
8Discount0%5%10%15%

For an order of 650, both return 10%:

Excel formula
=HLOOKUP(650,B7:E8,2,TRUE)
=XLOOKUP(650,B7:E7,B8:E8,,-1)

HLOOKUP with TRUE finds the largest value that is less than or equal to 650, which is 500. XLOOKUP's match_mode -1 means "exact match, or the next smaller item". The empty space between the commas skips the if_not_found argument. XLOOKUP also has 1 for "the next larger item", which HLOOKUP can't do.

When to use HLOOKUP#

Use HLOOKUP when the file must work everywhere, or when a task asks for it by name. It is a fine choice when:

  • Colleagues use Excel 2019 or older. XLOOKUP shows #NAME? in those versions.
  • A test asks for HLOOKUP. Some job tests still name it, and a grader may check the function you used.
  • The table is stable. If nobody inserts rows, a fixed row number is safe.
  • You only ever read rows below the header. That is exactly what HLOOKUP was built for.

Always finish an exact-match HLOOKUP with FALSE. Without it, a lookup on unsorted codes can quietly return the wrong column's value.

When to use XLOOKUP#

Use XLOOKUP for new work whenever everyone has Excel 2021, Excel 2024 or Microsoft 365. It is the better choice when:

  • The answer is above the row you search, as in Task 2.
  • Rows may be added later. XLOOKUP's ranges move when rows are inserted, so the formula keeps pointing at Price.
  • You want a clean message instead of #N/A, without wrapping the formula in IFNA.
  • The tier row isn't sorted, or you need "the next larger" band.
  • The table lives on another tab. See how to use XLOOKUP from another sheet.

The complete guide to XLOOKUP covers every argument, and the XLOOKUP function guide is a quick syntax reference. If you need every matching value rather than the first one, look at XLOOKUP vs FILTER.

Common mistakes with HLOOKUP and XLOOKUP#

These slips cause most wrong or broken horizontal lookups:

  1. Leaving out FALSE in HLOOKUP. The default is an approximate match, which can return a neighbour's value with no error.
  2. Counting the row number from row 1 of the sheet. HLOOKUP counts from the top row of the table. If the table starts in row 5, row 5 is 1.
  3. Inserting a row inside the table. Add a "Colour" row between Item and Price and =HLOOKUP("P-300",A1:E5,3,FALSE) now returns the colour. XLOOKUP's B3:E3 becomes B4:E4 by itself.
  4. XLOOKUP rows of different widths. =XLOOKUP("P-300",B1:E1,B3:D3) returns #VALUE!, because the two rows must cover the same columns.
  5. Not locking ranges before filling across. Press F4 on Windows or ⌘T on a Mac to add $ signs, then fill right with Ctrl+R (⌘R on a Mac).
  6. Codes stored as text on one side and numbers on the other. The value 100 doesn't match the text "100" in either function.

Our recommendation#

Learn XLOOKUP as your default lookup in any direction. It replaces HLOOKUP and VLOOKUP with one function, it is exact by default, it can return from a row above, and inserted rows don't break it. Keep HLOOKUP in your toolkit for older files and for tests that name it, and always end it with FALSE when you want an exact match.

In short: XLOOKUP for new work, HLOOKUP with FALSE for older Excel.

Practise it#

Try the exercise on this page: it asks for the one lookup HLOOKUP can't do. Then practise HLOOKUP on a sideways rate card and practise XLOOKUP in a live spreadsheet, where you type each formula and it is checked instantly.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Which product code belongs to the Shelf? In B7, use XLOOKUP to find the item name in B6 in row 2 (B2:E2) and return the code from row 1 (B1:E1). HLOOKUP can't do this, because the answer is in a row above.

fx
ABCDEF
1
Code
P-100
P-200
P-300
P-400
2
Item
Desk
Chair
Lamp
Shelf
3
Price
240
85
32
120
4
Stock
12
40
0
7
5
6
Item
Shelf
7
Code
8
9
10

Tip: Three parts: what to find (B6), the row to search (B2:E2), and the row to return from (B1:E1).

Practise this in a lesson

LessonHLOOKUP for horizontal tablesRead a sideways rate card with HLOOKUP, which searches across the top row instead of down the first column.LessonXLOOKUPLook up in any direction with XLOOKUP and show a friendly message when nothing matches.Function guideXLOOKUPXLOOKUP explained with real examples: exact matches, looking left and custom not-found messages, plus a live exercise to try now.

Frequently asked questions

Can XLOOKUP replace HLOOKUP?

+

Yes. XLOOKUP looks up across a row as easily as down a column, so it can do every HLOOKUP job. The only reason to keep HLOOKUP is a file that must work in Excel 2019 or older.

Why does my HLOOKUP return the wrong value?

+

The two usual causes are a missing FALSE at the end, which turns on approximate matching, and a row number that no longer points at the right row after someone inserted a row in the table.

How do I do a horizontal lookup with XLOOKUP?

+

Give XLOOKUP a row as the lookup array and a matching row as the return array, for example =XLOOKUP("P-300",B1:E1,B3:E3). Both rows must cover the same columns.

Can HLOOKUP look up a value in a row above?

+

No. HLOOKUP always searches the first row of its table and returns from a row below it. Use XLOOKUP or INDEX with MATCH to return a value from a row above.

Is HLOOKUP still used?

+

Yes, mostly in older files and in job tests that ask for it by name. For new work in current Excel, XLOOKUP is simpler and safer.

Sources

  • HLOOKUP function - Microsoft Support
  • XLOOKUP function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. HLOOKUP vs XLOOKUP at a glance
  2. How the syntax differs
  3. The same lookup, side by side
  4. Approximate matches: tiers and bands
  5. When to use HLOOKUP
  6. When to use XLOOKUP
  7. Common mistakes with HLOOKUP and XLOOKUP
  8. Our recommendation
  9. Practise it

Keep reading

Comparisons· 7 min read

INDEX MATCH vs XLOOKUP: Is INDEX MATCH Still Worth Learning?

Yes, INDEX MATCH is still worth learning. XLOOKUP is shorter and has a built-in "not found" message, so use it for new files when everyone has Excel 2021, Excel 2024 or Microsoft 365. INDEX MATCH works in every version, appears in many existing workbooks, and still comes up in interviews.

Comparisons· 7 min read

VLOOKUP vs XLOOKUP: Which Should You Use?

Use XLOOKUP if everyone who opens the file has Excel 2021, Excel 2024 or Microsoft 365: it can look left, defaults to an exact match and doesn't break when columns move. Use VLOOKUP when the file must work in older versions such as Excel 2019, or when a job test asks for it by name.

Comparisons· 7 min read

XLOOKUP vs FILTER: One Match or All Matches?

Use XLOOKUP when you want one answer: the first (or last) match, such as one customer's phone number or a price for a code. Use FILTER when you want every match: all orders for a customer, spilled into rows below. Both need Excel 2021, Excel 2024 or Microsoft 365.

More on comparisons

  • IFERROR vs IFNA: Which Should You Use?
  • IFERROR vs ISERROR: Which One Should You Use?
  • INT vs TRUNC in Excel: Different With Negatives
  • IPMT vs PPMT: Interest and Principal in Excel
  • IRR vs XIRR in Excel: Which One Should You Use?
  • ISBLANK vs ="" in Excel: Which Test for Empty
All comparisons articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free