XLOOKUP If Not Found: Return Blank, 0 or “Not Found”

Quick Answer

Put your fallback in XLOOKUP’s fourth argument: =XLOOKUP(I2,A2:A8,C2:C8,"Not found") shows a message, ,"") looks blank, and ,0) returns zero. Use 0 when the result feeds a calculation; use a message when a person must see the missing item. No IFERROR needed.

=XLOOKUP(I2, A2:A8, C2:C8, "Not found")

Your price list is clean. Your formula is correct. Then one customer asks for a product code that is not on the list, and your beautiful sheet fills with #N/A. If that has happened to you, this guide is for you. In my classes, this is the exact moment students start wrapping every formula in IFERROR – and hiding real mistakes along with the harmless ones. There is a cleaner way, built into XLOOKUP itself.

1. The if_not_found argument

XLOOKUP takes up to six arguments. The fourth one, if_not_found, tells Excel what to show when the value you are looking for is not there:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

Leave it out, and a missing value gives you #N/A. Fill it in, and you choose the result. Every example in this guide uses this price list (download the practice file below and follow along):

SKUProductPriceIn stock
PT-1001Ceramic planter, small$14.5032
PT-1002Ceramic planter, large$29.0011
PT-1004Hanging macrame holder$18.75(empty)
PT-1007Self-watering pot$22.008
PT-1009Terracotta set of 3$19.990
PT-1012Plant stand, oak$64.005
PT-1015Watering can, brass$38.0014

With the SKU you want in cell I2, the basic formula is:

=XLOOKUP(I2, A2:A8, C2:C8, "Not found")

If I2 holds PT-1012, the result is 64. If it holds PT-1003, which is not on the list, the result is the words Not found. No error, no confusion.

2. Return “Not found”, blank, or 0 – which to choose

The fourth argument accepts any value. Choose by asking one question: what happens to this result next?

You wantFormula endingUse it when
A clear message,"Not found")A person reads the sheet and must see missing items
A blank-looking cell,"")The sheet is for display only, and blank means “nothing to show”
Zero,0)The result feeds a SUM, a total, or a multiplication
A value from a cell,$H$1)You want to change the message in one place for every formula

Why blank can break your totals

Two double quotes, "", return empty text. The cell looks blank, but it is not truly empty. Multiply it and Excel complains:

=XLOOKUP(I2, A2:A8, C2:C8, "")*3   ->  #VALUE!

Return 0 instead, and the line total becomes 0. Your grand total keeps working. Simple rule: if the result feeds a calculation, return 0. If a person reads it, return a message.

3. Search a second list as a backup

The fourth argument can itself be a formula. That gives you a backup search: look in the current price list first, and only if that fails, look in the old list (SKUs PT-0990 and PT-0995 in columns F and G of the practice file):

=XLOOKUP(I2, A2:A8, C2:C8, XLOOKUP(I2, F2:F3, G2:G3, "Not found"))

Type PT-0995 and the first lookup misses, the second one finds $26.50. Type PT-1003 and both miss, so you see Not found. This one pattern replaces long, fragile IFERROR chains.

4. The trap: a found row with an empty cell returns 0

Now look up stock for PT-1004. The SKU is on the list, but its In stock cell is empty. XLOOKUP returns 0 – not your “Not found” message. This is not a bug. Your fallback only handles a missing match; it does nothing when the match is found but the return cell is blank.

Compare PT-1009: its stock is a real 0. Both show 0, but they mean different things. One means “we forgot to type the stock,” the other means “we sold out.” If you must tell them apart, test the source cell with INDEX, which can see the empty cell:

=IF(ISBLANK(INDEX(D2:D8, MATCH(I2, A2:A8, 0))), "Stock not entered", XLOOKUP(I2, A2:A8, D2:D8, "Not found"))

For most sheets, the honest fix is simpler: type the missing stock number. Formulas should report your data, not paper over it.

5. Try It Now: the 2-minute practice

Open the Try_It sheet. Type each SKU into the green cell and predict the result before you press Enter:

  1. PT-1012 – found. Every test returns 64 (stock 5).
  2. PT-1003 – missing. Message, blank, and 0 versions separate here.
  3. PT-0995 – only in the old list. Only the backup formula finds $26.50.
  4. PT-1004 – found, empty stock. Watch Test 6 show 0 and explain why.

Check yourself: your invoice multiplies price by quantity. Which fallback – blank or 0 – keeps the invoice total correct for a missing SKU? (Answer: 0. Blank text breaks multiplication with #VALUE!.)

New to XLOOKUP? Start with our XLOOKUP instead of VLOOKUP guide, then come back here. More formulas live in the Excel & Google Sheets Formulas hub.

6. Key Takeaways

  • XLOOKUP’s 4th argument, if_not_found, replaces #N/A only when the match is missing.
  • Return 0 if the result feeds a calculation; return a message if a person reads the sheet; blank (“”) is text and breaks multiplication.
  • A second XLOOKUP inside if_not_found gives you a clean backup-list search.
  • Found row + empty return cell = 0 on screen. That is a data problem, not a formula problem.
  • Download the practice file and test PT-1012, PT-1003, PT-0995 and PT-1004 – you will understand this forever.

Join the conversation: Which fallback do you use in your sheets – a message, blank, or 0? Tell me in the comments, and share the formula that finally fixed your #N/A problem.

7. Frequently Asked Questions

Why does XLOOKUP return 0 instead of my message?

Your fallback handles a missing match. If the SKU is found but the return cell is empty, Excel displays 0. Check the source cell first – in our practice file, PT-1004 has no stock typed in.

Should I use IFERROR around XLOOKUP instead?

Usually no. IFERROR hides every error, including real mistakes like a broken range. if_not_found replaces only the missing-match #N/A, so genuine problems stay visible.

Does XLOOKUP work in older Excel?

XLOOKUP needs Microsoft 365, Excel 2021 or later, or Excel for the web. In older versions, use =IFNA(VLOOKUP(I2,A2:C8,3,FALSE),"Not found") for the same friendly message.

Does this work in Google Sheets?

Yes. Google Sheets supports XLOOKUP with the same if_not_found argument, and the practice file formulas work there unchanged.

Blank or 0 – which is safer?

0 is safer for anything that calculates: totals, averages and multiplications keep working. Blank looks cleaner on a display-only sheet, but it is text, and text breaks arithmetic.

Keep Learning

This guide is part of our Excel & Google Sheets Formulas hub – start there for lookup, logic and totals formulas in plain language. Stuck on a real spreadsheet at work? Our Excel & Sheets help service fixes formulas with you, one-to-one.

Leave a Comment