Sub topic 17
Troubleshooting wrong totals and errors
This chapter assumes you can write SUMIFS, COUNTIFS, and AVERAGEIFS formulas with criteria pairs, and that you know the sample sales data (Date, Region, Product, Amount, Notes in rows 2 to 100). It covers the failures you will meet most often and how to find each cause.
Start with the symptom
A formula either shows an error or shows a number that looks wrong. Each case has a short list of causes.
Errors
#VALUE! usually means the ranges are not the same size. D2:D100 with B2:B99 fails, because every range in the formula must have the same number of rows and columns. Select each range and check its address.
#DIV/0! comes from AVERAGEIFS when no row matches, because there is nothing to average. Wrap the formula so the result is readable:
=IFERROR(AVERAGEIFS(D2:D100, B2:B100, "South"), "No sales")IFERROR hides every error, including #VALUE!. Use it only after you know the ranges are correct.
Wrong totals with no error
These are harder to spot because Excel gives you a number.
- Extra spaces. A cell containing
"West "does not equal"West". Clean the column with TRIM, or search for the criteria with a trailing wildcard, such as"West*". - Text stored as numbers. SUMIFS ignores text in the sum range, so those amounts add nothing. Left-aligned numbers and a green corner mark are clues.
- Text stored as dates. A criterion like
">=" & DATE(2025,1,1)compares against real date values only. Text dates never match. - Wildcards in the data.
*and?in a criterion act as wildcards even when you mean them literally. Put~before the character to match it as plain text, as in"Lap~*". - Open end dates. Using
"<=" & DATE(2025,1,31)can drop times later on January 31. Use"<" & DATE(2025,2,1)instead.
A quick check for text dates
Compare the count of real numbers with the count of rows:
=COUNT(A2:A100) & " of " & ROWS(A2:A100)If the first number is smaller, some dates are text. Convert them with Data > Text to Columns, or multiply the column by 1.
Check one condition at a time
When a multi-condition formula returns zero, remove all pairs but one and confirm it works. Then add the pairs back one at a time. The pair that sends the total to zero holds the faulty range or criterion. A COUNTIFS with the same pairs is a quick way to see how many rows match.
Exercise
=SUMIFS(D2:D100, B2:B99, "West") returns #VALUE!. What is the cause, and what is the fix?
Show answer
The sum range has 99 rows and the criteria range has 98, so the sizes differ. Change B2:B99 to B2:B100 so both ranges cover the same rows.