Last updated on November 6th, 2026 at 04:31 pm
To do an XLOOKUP in Excel, click the cell where you want the answer and type =XLOOKUP(what to find, where to look, what to return), then press Enter. For example, =XLOOKUP(F2,A2:A9,C2:C9) finds the employee ID in F2 in column A and returns that person’s department from column C. XLOOKUP looks for an exact match unless you tell it otherwise, can return values from columns to the left, and lets you choose your own message when nothing matches.
Applies to: Excel for Microsoft 365 (Windows and Mac), Excel 2024, Excel 2021, Excel for the web and the Excel apps for iPad, iPhone and Android. XLOOKUP isn’t available in Excel 2019, Excel 2016 or earlier. The argument names and options below match Microsoft’s XLOOKUP function reference.
Before you start
- Check your Excel version. Start typing
=XLOin any cell. If XLOOKUP appears in the list of suggestions, you have it. If it doesn’t, jump to What to use in Excel 2019 or older. - Put each item on its own row. XLOOKUP works best with a simple list: one row per record, one column per detail (ID, name, department and so on), and a header row on top.
- Know three terms. The lookup value is what you’re searching for (an ID, a name, a product code). The lookup array is the column (or row) Excel searches. The return array is the column (or row) the answer comes from.
The examples in this guide use this small staff list in cells A1:D9. The names and IDs are made up.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ID | Name | Department | Office |
| 2 | 101 | Alex Rivera | Sales | Denver |
| 3 | 102 | Jordan Lee | Finance | Austin |
| 4 | 103 | Priya Shah | Marketing | Denver |
| 5 | 104 | Sam Carter | IT | Chicago |
| 6 | 105 | Morgan Diaz | Sales | Austin |
| 7 | 106 | Taylor Brooks | HR | Chicago |
| 8 | 107 | Casey Nguyen | Finance | Denver |
| 9 | 108 | Riley Patel | IT | Austin |
How the XLOOKUP formula is built
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Only the first three arguments are required. The ones in square brackets are optional, and you skip them by leaving them out or by typing nothing between two commas.
| Argument | What to put there |
|---|---|
| lookup_value | The value to find, usually a cell such as F2. |
| lookup_array | The range to search, such as A2:A9. |
| return_array | The range to return from, such as C2:C9. Make it the same height as lookup_array (or the same width, for a row). |
| if_not_found | Text or a value to show when there’s no match. Without it, you get #N/A. |
| match_mode | 0 exact match (default), -1 exact match or the next smaller item, 1 exact match or the next larger item, 2 wildcard match using *, ? and ~. |
| search_mode | 1 search first to last (default), -1 search last to first, 2 binary search on data sorted in ascending order, -2 binary search on data sorted in descending order. |
Write your first XLOOKUP
Goal: type an employee ID in F2 and see that person’s department in G2.
- Type a label such as ID in F1 and Department in G1, then type 104 in F2.
- Click cell G2 and type
=XLOOKUP(. A tooltip under the cell lists the arguments as you go.

- Click F2, then type a comma. This is the lookup_value.
- Drag to select A2:A9 (the IDs), then type a comma. This is the lookup_array.
- Drag to select C2:C9 (the departments). This is the return_array.
- Type
)and press Enter. The finished formula is=XLOOKUP(F2,A2:A9,C2:C9).
How to tell it worked: G2 shows IT, because ID 104 belongs to Sam Carter in the IT department. Type 107 in F2 and G2 changes to Finance. If you see #N/A, #NAME? or another error, go to Fix XLOOKUP errors.

If you plan to copy the formula down to other rows, lock the two ranges with dollar signs first: =XLOOKUP(F2,$A$2:$A$9,$C$2:$C$9). It’s the same technique you’d use to keep one cell constant in Excel. When the lookup list sits on a different worksheet, how to match data in Excel from 2 worksheets shows how to flag and pull the matching records.
To change the formula later, click G2 and edit it in the formula bar. To start over, press Ctrl + Z right after entering it, or select G2 and press Delete.
XLOOKUP examples for everyday tasks
Each example below uses the staff list unless it describes its own data. Pick the one that matches what you’re trying to do.
Show your own message instead of #N/A
=XLOOKUP(F2,A2:A9,C2:C9,"Not found")
With 999 in F2, the cell shows Not found instead of #N/A. You don’t need an IFERROR or IFNA wrapper. You can also use "" to show nothing, or 0 if the result feeds into a sum.
Return a value from a column on the left
=XLOOKUP(F2,B2:B9,A2:A9)
Type Priya Shah in F2 and the formula returns 103. It searches the names in column B and returns the ID from column A, which sits to the left. VLOOKUP can’t do this without rearranging the columns.
Return a whole record at once
=XLOOKUP(F2,A2:A9,B2:D9)
With 105 in F2, the result spills into three cells: Morgan Diaz, Sales and Austin. You type the formula once and Excel fills the neighboring cells. The two cells to the right of the formula must be empty, or you’ll get a #SPILL! error.

Find the most recent entry (last match)
Say an order log has customer names in A2:A8, order dates in B2:B8 and amounts in C2:C8, with the oldest orders at the top. Jordan ordered on September 2 (120), September 11 (64) and October 3, 2026 (148).
=XLOOKUP("Jordan",A2:A8,B2:B8,,0,-1)
Setting search_mode to -1 makes Excel search from the bottom up, so this returns October 3, 2026, Jordan’s latest order. Without the -1 you’d get September 2. The empty space between the two commas skips if_not_found, and the 0 keeps an exact match. If you see a number like 46298 instead of a date, format the cell as a date.
Match a score, price or amount to a band
For grades, tax bands, shipping rates or commission tiers, list the starting value of each band. Here, E2:E6 holds 0, 60, 70, 80 and 90, and F2:F6 holds the grades F, D, C, B and A. A student’s score is in B2.
=XLOOKUP(B2,$E$2:$E$6,$F$2:$F$6,,-1)
A score of 84 returns B, because 84 isn’t in the list and 80 is the next smaller value. A score of 90 returns A (exact matches still win), and 59 returns F. Use 1 instead of -1 when a value should move up to the next band, for example a 7-pound parcel that must ship in the 10-pound rate.
With the default search mode, XLOOKUP is generally able to find the next smaller or larger value even when the band list isn’t sorted, but keeping it sorted from smallest to largest makes mistakes much easier to spot.
Find a partial match with wildcards
=XLOOKUP("*"&F2&"*",B2:B9,C2:C9,"None",2)
With Lee in F2, this finds the first name that contains “Lee” and returns Finance (Jordan Lee). The 2 in match_mode turns on wildcards: * stands for any number of characters and ? for exactly one. To search for a real asterisk or question mark, put a tilde in front of it, such as ~*. Without match_mode 2, XLOOKUP treats * and ? as ordinary characters.
Look up a row and a column at the same time
Picture a sales grid with products in A2:A5 (Desk, Chair, Lamp, Shelf), months in B1:E1 (Jan to Apr) and sales figures in B2:E5. The product to find is in H2 and the month in H3.
=XLOOKUP(H3,B1:E1,XLOOKUP(H2,A2:A5,B2:E5))
The inner XLOOKUP finds the product’s row and returns all four monthly figures. The outer XLOOKUP searches the month headers, which run across a row, and picks the right figure from that set. With Lamp in H2 and Mar in H3, the result is the number where the Lamp row meets the Mar column. This also shows that XLOOKUP works on rows as well as columns, so it can replace HLOOKUP.
Match on two conditions
If first names repeat, combine two columns. With first names in A2:A5, cities in B2:B5 and phone extensions in C2:C5:
=XLOOKUP(1,(A2:A5=F2)*(B2:B5=G2),C2:C5,"No match")
Each comparison gives TRUE or FALSE for every row, and multiplying them gives 1 only where both are true. XLOOKUP then looks for that 1. With Alex in F2 and Austin in G2, it returns the extension for the Alex who works in Austin, not the one in Denver.
Add up everything between two lookups
XLOOKUP returns a range, not just a value, so two of them can mark the start and end of a range. With month names in A2:A13 and monthly sales in B2:B13:
=SUM(XLOOKUP(G1,A2:A13,B2:B13):XLOOKUP(G2,A2:A13,B2:B13))
With Mar in G1 and Jun in G2, this adds March, April, May and June. Change either month and the total updates.
Look up data on another sheet
=XLOOKUP(A2,Prices!A2:A200,Prices!C2:C200,"No price")
Put the sheet name and an exclamation mark before each range, here a sheet called Prices. For a full walkthrough with two lists, see how to use XLOOKUP in Excel with two sheets.
Make lookups grow with your data
Ranges like A2:A9 don’t grow when you add employee 109 in row 10. Convert the list to an Excel table instead: click any cell in the data and press Ctrl + T, confirm the range, then select OK. If the table is named Staff, your formula can then use column names:
=XLOOKUP(F2,Staff[ID],Staff[Department],"Not found")
These structured references adjust automatically when you add or remove rows. One catch: a formula that returns several columns can’t spill inside a table, so put multi-column XLOOKUPs in cells outside it.
XLOOKUP or VLOOKUP?
| XLOOKUP | VLOOKUP | |
|---|---|---|
| Default match | Exact | Approximate, unless the last argument is FALSE |
| Where the lookup column can be | Anywhere | Must be the first column of the range |
| How you pick the answer column | Select it | Type a column number, which doesn’t update if you insert or move columns |
| Custom “not found” result | Built in | Needs IFERROR or IFNA |
| Search from the bottom | Yes (search_mode -1) | No |
| Works in Excel 2019 and older | No | Yes |
If everyone who opens the file has Microsoft 365, Excel 2021 or newer, XLOOKUP is the simpler choice. If some people use older versions, stick with the VLOOKUP formula or INDEX/MATCH. When you do use VLOOKUP, recheck its column number after you move a column in Excel.
What to use in Excel 2019 or older
XLOOKUP arrived as a new function in Excel 2021 and Microsoft 365, and it isn’t available in Excel 2016 or Excel 2019. If someone opens your workbook in one of those versions, XLOOKUP cells show #NAME? once the formula recalculates, and the formula bar may show an _xlfn. prefix in front of the function name.
The closest substitute is INDEX with MATCH, which also looks left:
=INDEX(C2:C9,MATCH(F2,A2:A9,0))
The 0 in MATCH asks for an exact match, like XLOOKUP’s default. To add a “not found” message, wrap it in IFERROR. For more on this pairing, read how to use INDEX and MATCH in Excel.
Fix XLOOKUP errors
#N/A: no match found
This is the most common result, and it usually means the data doesn’t match exactly even though it looks the same.
- Extra spaces. “Jordan Lee ” with a trailing space won’t match “Jordan Lee”. Clean the data with TRIM, or use
TRIM(F2)as the lookup value. - Numbers stored as text. The number 104 doesn’t match the text “104”. Check the format of the lookup cell and the lookup column and make them the same type. Data > Text to Columns can convert a whole column at once.
- The value really isn’t there. Add an if_not_found argument so the sheet shows a clear message instead of an error.
#VALUE!
Check that lookup_array and return_array are the same size. A2:A100 with C2:C99 is a common slip after copying or editing a formula, and mismatched sizes generally produce #VALUE! instead of a result.
#NAME?
Either the function name is misspelled (look for “XLOOKUP” with no spaces) or the version of Excel you’re using doesn’t include XLOOKUP. See What to use in Excel 2019 or older.
#SPILL!
The formula wants to return more than one cell and something blocks it. Click the cell with the error, select the warning icon next to it, and choose Select Obstructing Cells to see what’s in the way. Clear those cells, move the formula, or return a single column. Spilled results also can’t go inside an Excel table, run past the edge of the sheet, or overlap merged cells. The full list of causes is on the #SPILL! error help page.

A wrong answer with no error
- Check match_mode. -1 means “this value or the next smaller one”; 1 means “this value or the next larger one”. Mixing them up gives a believable but wrong result.
- Check search_mode 2 or -2. Binary search is only for data sorted in the matching order. On unsorted data it returns invalid results. Remove that argument unless your data is sorted and very large.
- Check for duplicates. XLOOKUP returns the first match it finds (or the last, with search_mode -1). If a value appears twice, you may be looking at the wrong row.
- A 0 where you expected a blank. When the matching cell in return_array is empty, the result is generally 0. Adding
&""to the end of the formula shows a blank instead, but it turns numbers into text, so skip that trick when you need to do math with the result.
Frequently asked questions
Can XLOOKUP return every match, not just one?
No. XLOOKUP stops at the first match (or the last, with search_mode -1). To list every match, use the FILTER function in Excel for Microsoft 365, Excel 2024 or Excel 2021. For example, =FILTER(C2:C8,A2:A8="Jordan","None") spills all of Jordan’s order amounts from the order log above (120, 64 and 148) into a column.
Is XLOOKUP case-sensitive?
Microsoft’s function page doesn’t say, and in practice XLOOKUP is generally treated as not case-sensitive, so “priya shah” finds “Priya Shah”. When capitals matter, such as product codes where “ab12” and “AB12” are different items, use the case-sensitive EXACT function inside it: =XLOOKUP(TRUE,EXACT(B2:B9,F2),A2:A9,"Not found").
Does XLOOKUP work with dates?
Yes. Excel stores dates as numbers, so XLOOKUP matches them like any other number. If your lookup cell holds a date and a time but the list holds dates only, strip the time with INT(F2) as the lookup value. To find the rate or price in effect on a given day, list the start dates and use match_mode -1.
Can I use XLOOKUP to combine two lists?
Yes. A column of XLOOKUP formulas can pull matching details from a second list into the first, which is often quicker than copying and pasting. See how to merge two tables in Excel for the full process. To spot items missing from the second list, =XLOOKUP(A2,Sheet2!A:A,Sheet2!A:A,"Missing") flags them, and you can find other ways to compare two sheets in Excel for matches.
Where to go from here
Start with the three-argument version on your own data, then add one option at a time: a “not found” message first, then a table so the formula grows with your list. If formulas in general are still new, the basics of using a formula in Excel will make every example here easier to follow.

Matt Jacobs writes and maintains the guides on Support Your Tech, which he started in 2017. He spent most of his career keeping small-business PCs running and still takes the occasional consulting job, so the steps here come from fixing the same problems on other people’s computers. Every guide is checked on his own Windows 11, Windows 10, Mac, iPhone and iPad before it goes up.