What you will learn
- Use XLOOKUP to find things
- Show a message when nothing is found
How it works
XLOOKUP has four parts:
- what to find
- where to look
- where the answer is
- what to show if it's not found
XLOOKUP works in newer versions of Excel.
Formulas at a glance
=XLOOKUP(value, lookup_range, return_range, if_not_found) | The pattern to follow |
Example
Write the formula to find the product name for code P-104 (A2). Show "Not found" if it's missing.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Code | Product | Price | Code | Product | Price |
| 2 | P-104 | P-101 | Pencil | $0.50 | ||
| 3 | P-109 | P-102 | Eraser | $0.75 | ||
| 4 | P-101 | P-103 | Marker | $2.40 | ||
| 5 | P-102 | P-104 | Ruler | $1.20 | ||
| 6 | P-105 | Binder | $4.95 | |||
| 7 | Found |
Click B2 and type =XLOOKUP(A2,$D$2:$D$6,$E$2:$E$6,"Not found"), then press Enter.
The answer is Ruler.
When to use it
- Any lookup in Excel 2021 or Microsoft 365
- Looking up to the left of the search column
- Lookups that need a friendly "not found" message
Common mistakes
- Seeing #NAME?XLOOKUP needs Excel 2021 or newer, or Microsoft 365. Use VLOOKUP or INDEX/MATCH in older Excel.
- Ranges of different sizesThe look-in range and the answer range must be the same size.
- Using a column number like VLOOKUPXLOOKUP uses a range for the answer, not a number.
Quick check
What kind of match does XLOOKUP use unless you say otherwise?
- Close match
- Exact match
- Wildcard
- None
Show the answer
B. Exact match It looks for an exact match.
Practice it on a real sheet
Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.