XLOOKUP returns a #N/A error when no match is found. To replace that error with your own text or value, use the fourth argument of XLOOKUP, called if_not_found. The syntax is =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). So if you want "Not found" instead of #N/A, you write =XLOOKUP(A2, D:D, E:E, "Not found"). That is the direct answer. The rest of this guide explains how to use that argument well, avoid common mistakes, and fix problems when the result is not what you expect.

What You'll Need

  • Excel 365, Excel 2021, or later (XLOOKUP is not available in Excel 2019 or earlier).
  • Your lookup table or range, with the lookup column and return column identified.
  • A clear idea of what should appear when no match exists: text, a number, a blank, or a formula.

Step-by-Step

  1. Write the basic XLOOKUP formula. Start with the three required arguments: lookup value, lookup array, and return array. For example, to find the price of an item in A2 from a table where item names are in D2:D100 and prices in E2:E100, type =XLOOKUP(A2, D2:D100, E2:E100).
  2. Add the if_not_found argument. After the return array, type a comma and then your fallback value in double quotes. For example: =XLOOKUP(A2, D2:D100, E2:E100, "Not found"). This replaces the default #N/A with the text "Not found".
  3. Use a number or blank if preferred. You can use 0, -1, or "" (empty text) as the fallback. For example, =XLOOKUP(A2, D2:D100, E2:E100, 0) returns 0 when the item is missing. Use "" to show nothing at all.
  4. Return a formula result instead of static text. The if_not_found argument can be an expression. For example, =XLOOKUP(A2, D2:D100, E2:E100, "Check "&A2) returns "Check [item name]" when not found. You can also nest another function, like IFERROR or a second XLOOKUP, but keep it simple to avoid confusion.
  5. Press Enter and copy down. After entering the formula, drag the fill handle or copy the cell to apply it to other rows. The if_not_found argument stays the same unless you use relative references.
  6. Test with a value you know is missing. Type a fake item in the lookup cell and confirm the fallback appears. Then restore the real value.
  7. Adjust for match_mode if needed. By default XLOOKUP uses exact match (0). If you use wildcard match (2) or approximate match (-1 or 1), the if_not_found argument still applies when no match is found under that mode. For example, with wildcard match, =XLOOKUP("*"&A2&"*", D2:D100, E2:E100, "No match", 2) returns "No match" if the pattern finds nothing.

Common Mistakes

  • Forgetting the comma before the fallback. The if_not_found argument is the fourth argument, so you need three commas after the return array if you also use later arguments. A missing comma causes a #VALUE! or #NAME? error.
  • Using the wrong data type. If your lookup values are numbers stored as text, XLOOKUP may not match them to numeric values. Ensure both sides are the same type, or use VALUE() to convert.
  • Assuming if_not_found catches all errors. It only handles the "not found" case. Other errors, such as #REF! from a deleted column, still appear. Use IFERROR around the whole formula if you need to suppress all errors.
  • Placing the fallback in the wrong argument position. Some users accidentally put the fallback as the fifth argument (match_mode), which causes unexpected results or errors. Double-check the order: lookup_value, lookup_array, return_array, if_not_found, match_mode, search_mode.
  • Using a fallback that looks like a real value. If you return "0" as text, it may be treated as text in later calculations. Use the number 0 without quotes for numeric fallbacks.

Tips

  • Use a descriptive fallback like "Not in list" or "Review needed" so users know what happened.
  • Combine with data validation to prevent users from entering values that are not in the list, reducing the need for fallbacks.
  • If you want to highlight missing values, use conditional formatting on the result column to color cells that equal your fallback text.
  • For dynamic arrays, XLOOKUP spills results; the if_not_found argument applies to each row individually.
  • Remember that XLOOKUP is not available in older Excel versions; use INDEX/MATCH with IFERROR as an alternative.

Troubleshooting

If the fallback does not appear when expected, check these items in order:

  1. Verify the lookup value exists. Use Ctrl+F to search for the value in the lookup array. If it exists but XLOOKUP still returns the fallback, check for extra spaces or non-printing characters. Use TRIM() or CLEAN() on both the lookup value and the lookup array.
  2. Check the lookup array and return array sizes. They must be the same size. If one is longer, XLOOKUP returns #VALUE!.
  3. Confirm the if_not_found argument is in the right position. Count the commas. The fourth argument is the fallback.
  4. Look for #N/A in the lookup array. If the lookup array itself contains errors, XLOOKUP may propagate them. Clean the data first.
  5. Ensure match_mode is correct. If you set match_mode to 1 or -1 (approximate), XLOOKUP may return the nearest match instead of the fallback. Use 0 for exact match unless you need otherwise.
  6. Check for hidden rows or filters. XLOOKUP works on the entire range regardless of filters, so hidden rows are still considered.
  7. If the formula returns #NAME?, XLOOKUP may not be supported in your Excel version. Check your version under File > Account.

Frequently Asked Questions

Can I use XLOOKUP to return multiple fallback values based on different conditions?

No, the if_not_found argument is a single value or expression. For conditional fallbacks, nest IF functions or use a helper column.

Does if_not_found work with wildcards?

Yes, if you set match_mode to 2 (wildcard match), the if_not_found argument applies when the wildcard pattern finds no match.

What happens if I omit the if_not_found argument?

XLOOKUP returns #N/A when no match is found, which can break calculations. Always provide a fallback if the lookup might fail.

Can I use a cell reference for the if_not_found argument?

Yes, you can point to a cell that contains the fallback value, e.g., =XLOOKUP(A2, D:D, E:E, G1). This makes it easy to change the fallback globally.

Is XLOOKUP available in Google Sheets?

Yes, Google Sheets supports XLOOKUP with the same arguments, including if_not_found. The syntax is identical.

Can I return a blank instead of text?

Yes, use "" (empty string) as the if_not_found argument to display nothing.