Answers / Question 19

SUMIFS returns 0 (or too little) when the numbers are stored as text (Excel + Google Sheets)

SUMIFS, SUMIF and SUM skip numbers stored as text, so the total comes back 0 or too low with no error. How to spot it in one formula, total the column without changing it, and convert it for good. Plus the criteria mistakes that cause the same symptom.

The problem

Your SUMIFS looks right: the ranges line up and the criteria match rows you can see. But the result is 0, or clearly lower than the rows add up to by hand, and there's no error to tell you why. This usually happens with data pasted from a website or exported from another system (a bank, an accounting tool, a CSV).

Inspired by a public question on Stack Overflow. The problem above is described in our own words and the solution below is ours.

Why it happens

A cell can show 1200 and still hold the text “1200”. SUM, SUMIF and SUMIFS add only real numbers and silently skip text, so every text amount counts as zero. Changing the cell format to Number doesn't convert what's already stored. Imports are the usual source, along with values that carry an invisible non-breaking space or a leading apostrophe.

Step 1: check the amount column

With amounts in C2:C500:

How many entries in the column are not real numbers (0 = all fine)Formula
=COUNTA(C2:C500)-COUNT(C2:C500)
Check one cell: TRUE = number, FALSE = textFormula
=ISNUMBER(C2)

Other clues: text is left-aligned by default, and Excel marks it with a small green triangle in the corner of the cell. If the count above is 0, the amounts are fine and the problem is in the criteria (see the last section).

Step 2a: total it anyway, without touching the data

SUMIFS needs real cell ranges, so wrapping the range in VALUE() inside SUMIFS doesn't work (Excel rejects the formula). Use SUMPRODUCT, which converts each entry as it adds. Here column A holds the region and column B a date:

Sum for region East, text amounts included (Excel 365 / Google Sheets)Formula
=SUMPRODUCT((A2:A500="East")*IFERROR(--TRIM(SUBSTITUTE(C2:C500,CHAR(160),"")),0))
Same, with a second condition: date on or after the date in F1Formula
=SUMPRODUCT((A2:A500="East")*(B2:B500>=F1)*IFERROR(--TRIM(SUBSTITUTE(C2:C500,CHAR(160),"")),0))

SUBSTITUTE(...CHAR(160)...) removes non-breaking spaces from web pastes, TRIM removes ordinary spaces, -- turns the text into a number, and IFERROR(...,0) counts blanks and words like “n/a” as zero. In older Excel versions, confirm the formula with Ctrl+Shift+Enter.

Step 2b: convert the column for good (best if you'll reuse it)

Helper column, both apps: next to the amounts, put this in D2 and fill it down, then copy column D and paste it over column C as values only, and delete the helper:

Clean number, or blank if the cell can't be a numberFormula
=IFERROR(VALUE(TRIM(SUBSTITUTE(C2,CHAR(160),""))),"")
Google Sheets: the whole column in one formulaFormula
=ARRAYFORMULA(IF(C2:C500="","",IFERROR(VALUE(TRIM(SUBSTITUTE(C2:C500,CHAR(160),""))),"")))

Excel shortcuts: select the column, click the warning icon and choose Convert to Number. Or use Data → Text to Columns and press Finish straight away. Or type 1 in a spare cell, copy it, select the amounts and use Paste Special → Values + Multiply. After converting, your original SUMIFS works unchanged.

Same symptom, different cause: the criteria

Comparison with a cell: the operator goes in quotes and the cell joins with &. ">=F1" compares against the text “F1” and matches nothing.

Right way to say “on or after the date in F1”Formula
=SUMIFS(C2:C500, A2:A500, "East", B2:B500, ">="&F1)

Trailing spaces in the criteria column: “East ” with a space doesn't equal “East”. Clean the column (Sheets: Data → Data cleanup → Trim whitespace; Excel: a TRIM helper column), or as a stopgap use a wildcard such as "East*" (which also matches “Eastern”).

Dates stored as text never match a date condition. See our answer on dates stored as text.

Ranges of different sizes (for example C2:C500 with A2:A499) make SUMIFS return an error instead of a total. Keep every range the same height.

Good to know

Formulas follow documented Google Sheets / Excel behavior; they aren't machine-tested, so try them on a copy first. Always try new automations on a copy of your sheet first.