Spreadsheet Practice

How to check if a cell contains an error in Excel

Formula (Excel and Google Sheets)

=IF(ISERROR(D2),"Fix row","OK")

Use ISERROR inside IF: =IF(ISERROR(D2),"Fix row","OK"). It is TRUE for #N/A, #VALUE!, #DIV/0! and every other error.

Result on the example
one result per row in E2, filled down to E7
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in E2, filled down to E7. Change any input and the result updates, or edit the formula to experiment.

How it works

ISERROR returns TRUE when the cell holds any error value. A-1 and A-4 have text where numbers belong, so their totals are #VALUE! and get flagged. A-6 has no quantity, which multiplies as 0 rather than erroring.

=IF(ISERROR(D2),"Fix row","OK")

Result"Fix row"

  1. D2#VALUE!

    The value in D2.

  2. ISERROR(D2)TRUE

    ISERROR: TRUE for any error.

    • valueD2#VALUE!
  3. IF(ISERROR(D2),"Fix row","OK")"Fix row"

    IF: Returns one value if a test is true, another if false.

    • logical_testISERROR(D2)TRUE
    • value_if_true"Fix row"
    • value_if_false"OK"not used

In Google Sheets

The same formula works in Google Sheets: =IF(ISERROR(D2),"Fix row","OK"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(ISERROR(D2),"Fix row",D2)Fix row, 37.5, 21.25…Different resultShows the total itself when there is no error. Shows the totals instead of "OK".
=ISERROR(D2)TRUE, FALSE, FALSE…Different resultThe bare TRUE or FALSE, for filters and conditional formatting. TRUE and FALSE instead of labels.

Common mistakes

  • ISERR is TRUE for every error except #N/A, and ISNA only for #N/A. Use ISERROR to catch them all.
  • IF(ISERROR(x),"…",x) calculates x twice. When you only need a replacement value, IFERROR(x,"…") does it once.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if a cell contains an error

In E2, show "Fix row" when the total in D2 is an error, otherwise "OK". Fill down to E7.

Questions

How do I highlight error cells?

Use =ISERROR(D2) as a conditional formatting rule, or Go To Special, Formulas, Errors to select them.

How do I check for #N/A only?

=IF(ISNA(D2),"Not found","OK").

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.