How to use IFERROR in Excel
IFERROR evaluates a formula and returns an alternative value if that formula produces an error. It is often used to display a clear message when a lookup value is missing.
IFERROR syntax
=IFERROR(value, value_if_error)
- value: the formula or expression to evaluate.
- value_if_error: the value to return if the formula produces an error.
Handle a missing VLOOKUP match
For product names in A2:A4, prices in B2:B4, and a product name to find in D2, use:
=IFERROR(VLOOKUP(D2, $A$2:$B$4, 2, FALSE), "Product not found")
If D2 matches a product, Excel returns its price. If it does not, the result is Product not found instead of a lookup error.
Use carefully: IFERROR handles any error from the wrapped formula, not only missing matches. A fallback can make a worksheet easier to read, but it can also hide an incorrect range or formula. For XLOOKUP, use its if_not_found argument when you only need to handle an absent match.
Continue with VLOOKUP, XLOOKUP, or the Excel lookup learning path. Browse all Excel tutorials.