XLOOKUP Not Working? Causes and Fixes
By ExcelReady TeamUpdated 6 min read
The short answer
XLOOKUP fails for a few clear reasons. #NAME? means your Excel version doesn't have it (it needs Microsoft 365 or Excel 2021 or later). #N/A means the value wasn't found, often because of spaces or text vs numbers. #VALUE! means the lookup and return ranges are different sizes. Add a fourth argument such as "Not found" to handle missing values.
Key takeaways
- XLOOKUP only exists in Microsoft 365, Excel 2021, Excel 2024 and Excel for the web; older versions show #NAME?.
- The fourth argument, if_not_found, replaces #N/A with your own message.
- The lookup array and return array must have the same number of rows, or XLOOKUP returns #VALUE!.
- Wildcards like "C*" only work when match_mode is 2.
- XLOOKUP returns the first match; set search_mode to -1 to get the last one.
On this page+
When XLOOKUP is not working, the error it shows tells you most of what you need to know. #NAME? points to your Excel version, #N/A to the data, and #VALUE! to the ranges. This guide goes through each error and the quieter problems, like wildcards that don't match and duplicates that return the wrong row, with a fix for every one.
XLOOKUP errors at a glance#
Start with the error in the cell. Each one has a small set of causes:
| What you see | Most likely cause | Fix |
|---|---|---|
| #NAME? | Excel version without XLOOKUP, or a typo | Use Microsoft 365 / Excel 2021+, or INDEX MATCH |
| #N/A | Value not found: spaces, text vs numbers, typo | Clean the data; add if_not_found |
| #VALUE! | Lookup and return ranges are different sizes | Make the ranges match |
| #SPILL! | The result needs more cells than are free | Clear the cells next to the formula |
| Wrong value | Wildcards, match mode or duplicates | Set match_mode or search_mode |
The full syntax, for reference:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])The examples use this product list in A1:C7:
| A | B | C | |
|---|---|---|---|
| 1 | Code | Product | Price |
| 2 | A-100 | Desk | 250 |
| 3 | A-101 | Chair | 120 |
| 4 | B-200 | Lamp | 45 |
| 5 | B-201 | Shelf | 180 |
| 6 | C-300 | Monitor | 210 |
| 7 | C-301 | Mouse | 25 |
=XLOOKUP("B-200",A2:A7,C2:C7) returns 45. The guide to using XLOOKUP covers the basics.
#NAME?: your Excel doesn't have XLOOKUP#
XLOOKUP is available in Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. Excel 2019, 2016 and older don't have it. If you open a file with XLOOKUP in an older version, the formula shows #NAME?, and the formula bar may show _xlfn.XLOOKUP.
Check your version under File > Account (Mac: Excel > About Excel). If people who share the file use older Excel, use INDEX MATCH instead, which works everywhere:
=INDEX(C2:C7,MATCH("B-200",A2:A7,0))If your version is new enough, #NAME? usually means a typo, such as XLOOKUP spelled wrong or text without quotes. The INDEX MATCH vs XLOOKUP comparison helps you choose.
#N/A: the value wasn't found#
#N/A means XLOOKUP looked through the whole lookup array and found no exact match. Sometimes that's correct: the code really isn't there. Often, though, the value is there but doesn't match exactly:
- Extra spaces. "B-200 " with a trailing space doesn't match "B-200". Check with
=LEN(A4), and clean the column with TRIM. - Text vs numbers. The number 1004 and the text "1004" are different. Convert the column with Convert to Number, or adjust the lookup value:
E2&""makes it text andVALUE(E2)makes it a number. - Typos and look-alike characters, such as a letter O instead of a zero.
These causes are the same for every lookup function. See VLOOKUP not working and INDEX MATCH not working for more examples.
How to show a message instead of #N/A#
XLOOKUP has a built-in fourth argument, if_not_found, for values that are genuinely missing:
=XLOOKUP("D-400",A2:A7,C2:C7,"Not found")There's no code D-400, so the result is Not found instead of #N/A. You can return text, "" for a blank, or a number such as 0. This is better than wrapping the formula in IFERROR, because it only handles "not found" and still shows real errors like #VALUE!. The article on XLOOKUP if not found has more patterns.
#VALUE!: the ranges are different sizes#
The lookup array and the return array must have the same number of rows (or columns, for a horizontal lookup). If they don't, XLOOKUP returns #VALUE!:
=XLOOKUP("B-200",A2:A7,C2:C6)A2:A7 has six rows and C2:C6 has five. Fix it to C2:C7. This often happens after you add rows and only update one range. Turning the data into an Excel table (Windows: Ctrl+T; Mac: ⌘T) and using its column names keeps both ranges the same size automatically.
#SPILL!: the result has no room#
XLOOKUP can return more than one cell. If the return array has several columns, such as B2:C7, it returns both Product and Price side by side. If you give it several lookup values, such as E2:E4, it returns several results down the column. Those results spill into neighbouring cells, and if any of them already hold something, you see #SPILL!.
Clear the cells the result needs, or return a single column. Also avoid whole-column references like A:A as the lookup value: that asks for over a million results.
Wrong value: wildcards, match mode and duplicates#
Sometimes XLOOKUP returns a value, just not the one you wanted.
Wildcards need match_mode 2. By default, * and ? are normal characters, so "C*" looks for the literal text C*. Set the fifth argument to 2:
=XLOOKUP("C*",A2:A7,B2:B7,,2)This returns Monitor, the first code starting with C. The two commas leave if_not_found empty.
Approximate match needs match_mode -1 or 1. For tier tables like tax bands, -1 returns the next smaller value and 1 the next larger. Leave it out and XLOOKUP only does exact matches, so a value between tiers gives #N/A.
Duplicates return the first match. If a code appears twice, XLOOKUP returns the first one from the top. Set the sixth argument, search_mode, to -1 to search from the bottom and get the last match. Don't use search_mode 2 or -2 (binary search) unless the data is sorted, because on unsorted data it can return wrong results.
The XLOOKUP function guide lists every match_mode and search_mode value.
Practise it#
Practise XLOOKUP in a live spreadsheet: you'll write exact lookups, add an if_not_found message and look to the left, with each formula checked instantly. Then fix broken formulas in the lookup errors lesson to practise spotting #N/A and #VALUE! causes. Start with the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Code D-400 in E2 isn't in the list, so a plain XLOOKUP shows #N/A. Click F2 and look up E2 in A2:A7, return the price from C2:C7, and add "Not found" as the fourth argument. Press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Price | Price | |||||
| 2 | D-400 | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 |
Tip: Four parts: what to find, where to look, what to return, and the message if it's missing.
Practise this in a lesson
Frequently asked questions
Why is XLOOKUP not available in my Excel?
XLOOKUP is only in Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. In Excel 2019 or older, the formula shows #NAME?. Use INDEX MATCH or VLOOKUP there instead.
Why is XLOOKUP returning #N/A?
It couldn't find the lookup value. Check for extra spaces, numbers stored as text, or a typo. Add a fourth argument such as "Not found" to show a message instead of the error.
Why does XLOOKUP return #VALUE!?
The lookup array and the return array are different sizes, for example A2:A7 and C2:C6. Make both ranges cover exactly the same rows.
How do I use wildcards in XLOOKUP?
Set the fifth argument, match_mode, to 2. For example, =XLOOKUP("C*",A2:A7,B2:B7,,2) finds the first code starting with C. Without the 2, the asterisk is treated as a normal character.