Excel beginner

How to Use XLOOKUP with a Fallback Message

Discover how to effectively use XLOOKUP to retrieve values while providing a custom message for missing data, enhancing your Excel skills.

Formula Genius can generate a draft from a plain-English prompt. Supported formulas can be checked with sample cases; review the coverage on the result.

The formula

Prompt

"Use XLOOKUP to look up a value and return a custom message when not found, without wrapping in IFERROR"

Excel
=XLOOKUP(A1, B1:B10, C1:C10, "Not Found")

This formula uses XLOOKUP to find a value and returns a specified message if the value is not found.

Step-by-step breakdown

  1. A1 is the lookup value you want to find.
  2. B1:B10 is the range where the formula searches for the lookup value.
  3. C1:C10 is the range from which the formula retrieves the corresponding value.
  4. "Not Found" is the custom message returned if the lookup value is not found.

Edge cases & warnings

  • The lookup value is blank, which may return the custom message.
  • The lookup value exists but is formatted differently (e.g., text vs. number).
  • The lookup range contains duplicates, and the first match is returned.
  • The lookup value is not present in the lookup range, triggering the fallback message.

Examples

Prompt

"If A1 is 'Apple' and B1:B10 contains 'Apple', 'Banana', 'Cherry', output is 'Fruit' from C1:C10."

Excel
Fruit
Prompt

"If A1 is 'Orange' and B1:B10 does not contain 'Orange', output is the fallback message."

Excel
Not Found

Frequently asked questions

Can I use XLOOKUP with multiple criteria?

Yes, you can combine multiple criteria using additional logic in your formula.

What happens if the lookup value is not found?

The formula will return the custom message specified in the fourth argument.

Is XLOOKUP available in all versions of Excel?

XLOOKUP is available in Excel 365 and Excel 2021.

Can't find what you need?

Describe a formula in plain English. Formula Genius drafts and explains it, and can check supported formulas on sample cases.