How to sum while avoiding error messages and hidden rows


Everyone knows to use SUM to add a range. But if the range contains error values, SUM won’t work — what do you use then? If you want to exclude values in hidden rows, SUM also can’t do that — what then? And if the range contains both error values and hidden rows, SUM still fails — what can you use?

To sum while excluding error values, there are two methods:
  1. =SUMIF(B2:B6,"<9.9E+99")
    • 9.9E+99 is an astronomically large number
    • In Excel, error values are treated as larger than any number
    • So in B2:B6 any value smaller than that astronomical number (i.e., all numeric values) will be summed
  2. =SUMPRODUCT(IFERROR(B2:B6,0))
    • Convert any error values in B2:B6 to 0
    • Then sum the original numbers and the zeros converted from error values — this effectively avoids the errors
To sum while excluding hidden rows, use the following method:
  • =SUBTOTAL(109,B2:B6)
    • In SUBTOTAL, function numbers 9 and 109 perform SUM
    • 109 additionally excludes manually hidden rows when summing
If the sum range contains both error values and hidden rows, use the following method:
  • =AGGREGATE(9,7,B2:B6)
    • In AGGREGATE, function number 9 is SUM
    • The second argument 7 tells AGGREGATE to ignore hidden rows and error values when performing the function specified by the first argument

Comprehensive Technical Support Solutions

We provide a range of technical support solutions to meet your needs.
Explore our core services:

man and woman wearing headphones while working in the office

Get on-demand assistance with Microsoft Excel, Word and PowerPoint. Send your question via WhatsApp, and we will help you resolve it promptly.

serious diverse students looking at laptop

Join our Online Learning Group Facebook page. Explore more than 200 tutorials and a comprehensive library of instructional videos at your own pace.

woman in yellow blazer doing a presentation

Build your team’s skills with tailored corporate training programmes. Our courses are designed around your organisation’s needs and equip employees with practical, up-to-date tools.