
Master every argument, wildcard matching, reverse search, and nested lookups — the Excel XLOOKUP formula explained from the ground up.
What You’ll Learn
XLOOKUP in Excel is the most powerful lookup function Microsoft has ever released, and if you are still doing everything with VLOOKUP, this guide is about to change how you work for good.
Here is the thing. Most people do not go looking for XLOOKUP. They stumble across it when a VLOOKUP finally lets them down. Maybe you needed to pull a value from a column to the left and realised you simply could not. Maybe someone added a column to your data and suddenly every VLOOKUP in the workbook was returning the wrong answer. Maybe you just got tired of wrapping every single formula in IFERROR to avoid staring at error messages all day.
XLOOKUP fixes all of that. And once you see what it can do beyond just replacing VLOOKUP, you will wonder how you managed without it. This lesson walks you through every argument in the Excel XLOOKUP syntax, covers the real-world scenarios that actually matter, and goes into the advanced features that most tutorials skip entirely.
XLOOKUP is a lookup and reference function available in Microsoft 365 and Excel 2021. It searches a range or array for a match and then returns a corresponding value from another range or array. That sounds straightforward, but the real power is the flexibility. XLOOKUP can search left, right, up, down, from the bottom upward, and across entire tables.
Think of it this way. VLOOKUP is like a one-way street — it only goes in one direction, and if your destination is behind you, you are out of luck. XLOOKUP is more like a GPS. You tell it where to look and where to return results from, completely independently, and it figures out the rest.
Microsoft released XLOOKUP in August 2019, initially for Microsoft 365 subscribers. It was later bundled into Excel 2021 as a permanent feature. If you are on Excel 2019 or any earlier version, XLOOKUP is not available to you.
Click on any empty cell and type =XLOOKUP( and pause. If Excel autocompletes the function, you are good to go. If nothing appears or you get a NAME error, you are on an older version. This compatibility point matters — we will come back to it when we cover sharing files.
There are three required arguments and three optional ones. Here is what each one does in plain language.
Excel XLOOKUP Syntax
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
— Required arguments: lookup_value · lookup_array · return_array
— Optional arguments: [if_not_found] · [match_mode] · [search_mode]
1. lookup_value — The value you are searching for. A number, text, cell reference, or the result of another formula.
2. lookup_array — The range you are searching through. Must be a single row or column.
3. return_array — The range you want to pull results from. Must have the same number of rows or columns as the lookup_array.
This is already one of the biggest reasons to switch from VLOOKUP. Instead of wrapping your formula in IFERROR, you handle missing values inside the formula itself:
=XLOOKUP(A2, D2:D100, E2:E100, "Not Found")| Value | Meaning |
|---|---|
0 | Exact match (default) |
-1 | Exact match or next smaller value |
1 | Exact match or next larger value |
2 | Wildcard match (*, ?, ~) |
| Value | Meaning |
|---|---|
1 | Search first to last (default) |
-1 | Search last to first — finds the most recent match |
2 | Binary search, ascending order (faster on large sorted data) |
-2 | Binary search, descending order |
Let’s build your first formula from scratch. You have an employee table: Employee ID in column A, Name in column B, Department in column C, Salary in column D. You want to type an Employee ID into G2 and see their salary in H2.
Step-by-Step: Build Your First XLOOKUP
Advertisement-X
=XLOOKUP("Employee not found" as your fallback message.=XLOOKUP(G2, A2:A100, D2:D100, "Employee not found")VLOOKUP needs a column index number. If Salary is in the 4th column, you type 4. Then someone inserts a new column and VLOOKUP silently returns the wrong value. XLOOKUP points directly at the return range, so it stays accurate no matter how your table changes.
The old VLOOKUP approach to error handling looked like this:
=IFERROR(VLOOKUP(A2, D:E, 2, 0), "Not Found")With XLOOKUP, you handle it inside the formula. No outer wrapper needed:
=XLOOKUP(A2, D2:D100, E2:E100, "Not Found")⚠️ Common Mistake
Leaving the if_not_found argument empty. If your lookup value does not exist in the data, Excel returns an ugly #N/A error. That breaks conditional formatting, confuses anyone reading the file, and causes downstream formulas to fail.
Always add a fourth argument — even if it is just "" for a blank or 0 for a zero.
| Error | Cause | Fix |
|---|---|---|
| #N/A | Lookup value not found, no if_not_found set | Add a fourth argument |
| #REF! | return_array and lookup_array are different sizes | Make sure both cover the same number of rows |
| #VALUE! | Data type mismatch (number stored as text) | Check and normalise data formats |
Here is the honest answer: use XLOOKUP whenever your version of Excel supports it. Here is the fuller picture if you need to explain it to someone else.
| Feature | VLOOKUP | XLOOKUP |
|---|---|---|
| Lookup direction | Left to right only | Any direction |
| Column reference | Column index number | Direct range reference |
| Error handling | Needs IFERROR wrapper | Built-in if_not_found |
| Multiple column return | One cell only | Entire row or column |
| Last match | First match only | First or last match |
| Compatibility | All Excel versions | Microsoft 365 / Excel 2021+ |
The one scenario where VLOOKUP still makes sense is compatibility. If you regularly share files with people using Excel 2019 or earlier, XLOOKUP formulas will show as errors on their end. In those cases, sticking with VLOOKUP is the safer choice.
If you want to brush up on exactly where VLOOKUP holds its own, check out the XplorExcel VLOOKUP lesson which covers all the cases where it remains a solid choice.
This is one of those features that you do not realise you needed until the moment it saves you an hour of manual work. Wildcard mode lets you search using partial text — invaluable when your data is inconsistent or you only know part of a value.
To use wildcards, set the fifth argument to 2:
=XLOOKUP("*"&A2&"*", D2:D100, E2:E100, "Not Found", 2)Your wildcard characters:
* matches any number of characters? matches exactly one character~ escapes a wildcard if you need to search for a literal asteriskYou work in procurement. Your supplier uses names like “Samsung 55 Inch QLED 4K Smart TV 2023 Model”. Your internal system just has “Samsung 55”. Nobody is typing that full name by hand.
=XLOOKUP("*"&A2&"*", B2:B500, C2:C500, "No match", 2)As long as the supplier’s product name contains “Samsung 55” anywhere, XLOOKUP finds it.
💡 Pro Tip
Wildcard mode is not case-sensitive. “samsung 55” and “SAMSUNG 55” both return the same match. You do not need to normalise the capitalisation in your lookup value first — XLOOKUP handles it for you.
Here is the one that genuinely surprises people the first time they see it work. XLOOKUP is not limited to returning a single cell. You can point the return_array at a multi-column range and XLOOKUP spills the entire result across adjacent cells automatically.
Instead of pointing at a single column, select a wider range:
=XLOOKUP(G2, A2:A100, B2:D100, "Not Found")This single formula returns all three columns (B, C, and D) for the matching row, spilling the results to the right automatically — no dragging, no copying.
A manager types an Employee ID into G2 and wants to see the full record. Without XLOOKUP this requires three separate formulas. With XLOOKUP, one formula written in H2 spills the Name, Department, and Salary into H2, I2, and J2 simultaneously. For large reporting dashboards, that means fewer formulas and fewer places where something can break.
A two-way lookup means searching by both row and column at the same time. The classic approach is INDEX-MATCH-MATCH, which works but takes a minute to write and is easy to get wrong. Nested XLOOKUP is cleaner.
You nest one XLOOKUP inside another at the return_array position. The inner XLOOKUP finds the right column. The outer XLOOKUP finds the right row. Their intersection is your answer.
=XLOOKUP(row_value, row_range, XLOOKUP(col_value, header_row, data_range))If the underlying logic of nested lookups feels unfamiliar, the XplorExcel INDEX-MATCH lesson builds exactly the intuition you need before practising this technique.
Scenario: Sales figures by Product and Month
XLOOKUP(G3, B1:M1, B2:M50) — this selects the entire March column.=XLOOKUP(G2, A2:A50, XLOOKUP(G3, B1:M1, B2:M50))Most users only ever use the default search mode. These two are worth adding to your toolkit — and one of them is a genuine hidden gem.
When your data has duplicate lookup values and you want the most recent one, set search_mode to -1. Excel starts from the bottom of your range and works upward, so the first match it encounters is the last one chronologically.
=XLOOKUP(A2, D2:D1000, E2:E1000, "Not Found", 0, -1)If your lookup column is sorted ascending, use search_mode = 2. Sorted descending, use -2. Instead of scanning every row one by one, Excel divides the range mathematically and narrows down the answer in steps — like flipping to the middle of a phonebook rather than reading from page one.
Only use binary search when your data is genuinely sorted. If it is not, you will get wrong results with no error warning.
A sales analyst has a transaction log with 10,000 rows. Customer names in column A, purchase dates in column B. They need the most recent purchase date for each customer:
=XLOOKUP(G2, A2:A10000, B2:B10000, "No purchases", 0, -1)💡 Pro Tip — Absolute References
Always lock your lookup_array and return_array with absolute references when copying formulas down a column:
=XLOOKUP(A2, $D$2:$D$100, $E$2:$E$100, "Not Found")The A2 reference stays relative and shifts as you drag down. The ranges stay fixed. Press F4 after selecting a range to toggle absolute references instantly.
For most workbooks, even with tens of thousands of rows, XLOOKUP is fast. On datasets of 500,000+ rows, binary search mode on sorted data is your first option. For anything beyond that scale, Power Query is the better tool for lookup logic.
XLOOKUP does not exist in Excel 2019, 2016, or earlier. If someone opens your file on one of those versions, they see a #NAME! error everywhere XLOOKUP appears. Your options:
Yes. When you select a multi-column or multi-row range as your return_array, XLOOKUP spills the results automatically into adjacent cells. No special array entry required in Microsoft 365.
It does, and it works very well. You can use structured table references directly:
=XLOOKUP(A2, EmployeeTable[ID], EmployeeTable[Salary], "Not Found")The formula reads clearly and adjusts automatically when rows are added to the table.
By default, no. XLOOKUP treats “Excel” and “EXCEL” as identical. If you need case-sensitive lookup behaviour, you would need a more complex approach using EXACT with XMATCH and INDEX. For the overwhelming majority of real-world use cases, the default behaviour is exactly what you want.
🧪 Try It Yourself
This exercise covers basic lookup, multi-column returns, and error handling all in one session.
📚 External Resources
Microsoft Official Documentation
The authoritative reference for every XLOOKUP argument with official examples and version notes.
support.microsoft.com → XLOOKUP function ↗Exceljet — XLOOKUP Function Guide
A clean, practical cheat sheet with concise syntax notes and quick-reference examples for the most common scenarios.
exceljet.net → XLOOKUP function ↗XLOOKUP in Excel is not just a shinier version of VLOOKUP. It is a genuinely better way to think about lookups in spreadsheets. It searches in any direction, handles missing values without extra wrappers, returns multiple columns at once, finds the last match in your data, and supports partial text matching with wildcards.
Start by replacing the VLOOKUPs you write most often. Then work through the optional arguments one at a time. Once you have a nested XLOOKUP working for a two-way lookup, something will click and you will realise how much unnecessary complexity you were dealing with before.
The Excel XLOOKUP formula is your new default. Get comfortable with it and you will find yourself reaching for it every single day.
Previous Lesson
← What-If Analysis in ExcelNext Lesson
Dynamic Array Functions in Excel →Advertisement-X