Logical & Error Handling Last updated: 2026-08-20

IFERROR Function in Excel & Google Sheets (Trap & Replace Errors)

Catch and replace #N/A, #VALUE!, #DIV/0!, #REF!, and #NAME? errors with custom text, zero, or blank cells using IFERROR and IFNA.

Quick Answer & Formula
Excel Sheets Beginner
=IFERROR(value, value_if_error)

IFERROR evaluates a formula; if the formula evaluates normally, it returns the result. If the formula returns ANY error (#N/A, #DIV/0!, #VALUE!, etc.), it returns your fallback value (such as "" for blank or 0).

IFERROR Function in Excel & Google Sheets

The IFERROR function traps spreadsheet errors and replaces them with a clean fallback value.


1. Preventing #DIV/0! Errors in Financial Math

=IFERROR((New_Sales - Old_Sales) / Old_Sales, 0)

2. Cleaning VLOOKUP Outputs

=IFERROR(VLOOKUP(A2, Products!A:D, 4, FALSE), "Not in Catalog")

3. Returning a Clean Blank Cell

To keep cells completely blank instead of displaying #N/A:

=IFERROR(VLOOKUP(A2, B:C, 2, FALSE), "")
?

Frequently Asked Questions

What is the difference between IFERROR and IFNA?

IFERROR catches ALL error types (#DIV/0!, #REF!, #VALUE!, #N/A). IFNA catches ONLY #N/A errors, allowing real syntax or reference errors to remain visible for debugging.