TechBuzzPro

Count Cells That Contain Errors in Excel

· 4 min read · Apps & Browsers

In this article
  1. Why Count Errors?
  2. How the Counting Formula Works
  3. Alternative Methods
  4. Common Mistakes and Misconceptions
  5. Counting Errors in Specific Situations
  6. How to Handle Errors After Counting
  7. Frequently Asked Questions

To count cells that contain errors in Excel, use the COUNT function combined with IFERROR, or use SUMPRODUCT with ISERROR. The most straightforward formula is =SUMPRODUCT(--ISERROR(range)), which returns the total number of cells in the specified range that display any error value (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!).

Why Count Errors?

Errors in Excel are not just visual annoyances; they indicate broken formulas, missing references, or invalid data. Counting them gives you a quick health check of your spreadsheet. Instead of scrolling through hundreds of rows, a single formula tells you how many cells need attention. This is especially useful in large datasets, financial models, or reports where an unnoticed error could lead to wrong conclusions.

How the Counting Formula Works

The core formula =SUMPRODUCT(--ISERROR(range)) works in two steps:

  1. ISERROR(range) checks every cell in the range and returns an array of TRUE/FALSE values. TRUE means the cell contains an error.
  2. The double negative -- converts TRUE to 1 and FALSE to 0. SUMPRODUCT then adds those 1s and 0s, giving the total count.

For example, if you have data in A1:A10 and cells A3, A7, and A9 contain errors, the formula returns 3. You can replace range with any contiguous or non-contiguous range, such as A1:A10 or A1:C5.

Alternative Methods

Besides SUMPRODUCT, there are other ways to count errors:

  • COUNTIF with specific error types: =COUNTIF(range,"#N/A") counts only #N/A errors. You can repeat this for each error type and add them together.
  • Array formula: =SUM(IF(ISERROR(range),1,0)) entered with Ctrl+Shift+Enter (in older Excel versions) achieves the same result.
  • Excel 365 dynamic arrays: =SUM(--ISERROR(range)) works without Ctrl+Shift+Enter in Excel 365 and Excel 2021, as dynamic arrays spill results automatically.

For a quick visual count, you can also use the Go To Special feature: press F5, click Special, choose Formulas, then uncheck everything except Errors. Excel will select all error cells, and the status bar will show the count.

Common Mistakes and Misconceptions

One common mistake is using =COUNTIF(range,ISERROR) which does not work because COUNTIF cannot evaluate a function like ISERROR directly. Another misconception is that =COUNT(range) counts errors – it does not; COUNT only counts numeric values, ignoring errors and text. Also, note that ISERROR returns TRUE for any error, including #N/A, while ISERR returns TRUE for all errors except #N/A. If you want to exclude #N/A, use =SUMPRODUCT(--ISERR(range)).

Counting Errors in Specific Situations

Sometimes you need to count errors based on a condition. For example, count errors only in rows where column B has a certain value. Use SUMPRODUCT with multiple conditions:

=SUMPRODUCT((ISERROR(A1:A10))*(B1:B10="Yes"))

This counts cells in A1:A10 that contain errors AND have "Yes" in the corresponding B cell. The multiplication acts like an AND operator. For counting errors across multiple sheets, you can use a 3D reference like =SUMPRODUCT(--ISERROR(Sheet1:Sheet3!A1:A10)), but this only works if the sheets are consecutive and the ranges are identical.

How to Handle Errors After Counting

Once you know how many errors exist, you might want to fix them. Common fixes include:

  • Wrap the original formula with IFERROR: =IFERROR(your_formula,"fallback") to display a blank or custom message instead of an error.
  • Use IFNA specifically for #N/A errors, which are often caused by VLOOKUP or XLOOKUP not finding a match.
  • Check for broken links, deleted cells, or incorrect range references.

Remember that errors are not always bad – sometimes they intentionally flag missing data. Counting them helps you decide whether to fix or suppress them.

Frequently Asked Questions

Can I count errors in a filtered list?

Yes, but the formula above counts all errors in the range, including hidden rows. To count only visible errors, use =SUMPRODUCT((ISERROR(range))*(SUBTOTAL(103,OFFSET(range,ROW(range)-MIN(ROW(range)),0)))) – this is complex, so a simpler approach is to use the status bar after selecting the filtered range, as it only counts visible cells.

Does COUNTIF work with error values?

COUNTIF can count cells that equal a specific error type, like =COUNTIF(range,"#N/A"). However, it cannot count all errors at once. For a total error count, SUMPRODUCT with ISERROR is the standard method.

Why does my formula return 0 even though I see errors?

If the errors are in text format (not actual Excel errors), ISERROR will not detect them. Ensure the cells contain real error values, not text that looks like an error. Also, check that the range reference is correct and does not include merged cells, which can cause unexpected results.

Can I count errors in a pivot table?

Pivot tables do not typically display errors, but if your source data contains errors, they may appear as blank or as the error text. To count them, you would need to count in the source range before creating the pivot table. Alternatively, use GETPIVOTDATA with error handling, but it is simpler to clean the source data first.

Is there a way to count errors without a formula?

Yes, use the Go To Special method described earlier. Select the range, press F5, then Special, choose Formulas and check Errors. The status bar will show "Count: X" for the selected error cells. This is a quick, one-time check without writing any formula.