How to Use the SUM Function in Excel: Examples, AutoSum and Fixes When the Total Is Wrong

The Excel SUM function adds numbers, cells and ranges. Typing it takes five seconds. Trusting the total is the harder part, because SUM quietly skips anything that is not a real number and still adds rows you have hidden. This guide uses one seven-row expense list, and every total below was worked out by hand from that list, including the two cases where SUM gives a different answer than you expect.

Excel SUM function example: expense list where SUM returns 1725 because text 45 is skipped
SUM returns 1725, not 1770: the coffee amount is stored as text and skipped

SUM function syntax

=SUM(number1, [number2], ...)

Each argument can be a number, a cell, a range or a mix: =SUM(B2:B8), =SUM(B2,B4,B6), =SUM(B2:B4,D2:D4,100). Microsoft allows up to 255 arguments in one SUM. A range counts as one argument however many cells it holds, so =SUM(B2:B10000) uses one of the 255, not ten thousand.

The fastest way in is AutoSum. Click the empty cell under a column of numbers and press Alt + = (on a Mac, Cmd + Shift + T). Excel writes the SUM and guesses the range above. Check the dotted border before you press Enter: AutoSum stops at the first blank cell, so a gap in the column means a partial total.

광고

A worked example

Type this list into a new sheet. Two cells are deliberately odd: B5 holds 45 entered as text (type an apostrophe first, '45), and B7 is left empty.

A: ItemB: Amount
2Rent1200
3Groceries340
4Internet60
5Coffee45 (stored as text)
6Gas85
7Gym(empty)
8Phone40

In B9, =SUM(B2:B8) returns 1725: 1200 + 340 + 60 + 85 + 40. The empty Gym cell adds nothing, which is fine. The coffee is the problem. The real spending is 1770, and SUM is 45 short without any warning, because SUM ignores text inside a range, even text that looks exactly like a number.

What SUM counts and what it skips

SUM treats a value differently depending on whether it sits in a cell you reference or is typed straight into the formula. Inside a range, only true numbers count. Typed directly, Excel tries to turn the value into a number first.

What the Excel SUM function adds in a range vs typed directly into the formula
Inside a range only real numbers count; typed-in values are converted first
ValueIn a referenced cell or rangeTyped into the formula
A number such as 85AddedAdded
Text that looks like a number, “45”SkippedAdded: =SUM("45",10) is 55
TRUE or FALSESkippedAdded as 1 or 0: =SUM(TRUE,1) is 2
A word such as “n/a”Skipped#VALUE!
An empty cellSkipped (adds 0)Not applicable
An error such as #N/AThe whole SUM shows #N/AThe whole SUM shows the error

Dates and times are numbers underneath, so SUM adds them too. That is useful for hours (format the total as [h]:mm so it can go past 24) and meaningless for calendar dates.

광고

Why SUM and the plus sign give different totals

Now type =B2+B3+B4+B5+B6+B7+B8 next to the SUM. It returns 1770, not 1725. The plus operator converts number-like text before adding, so the coffee counts, and the empty Gym cell counts as 0. Neither formula is broken; they follow different rules. A word in the range would break the plus version with #VALUE! while SUM simply skips it.

Excel SUM vs plus sign vs SUMPRODUCT totals on the same list
The same list gives 1725 with SUM and 1770 with the plus sign or SUMPRODUCT

Two quick checks tell you whether a column has hidden text. =COUNT(B2:B8) counts numbers and returns 5. =COUNTA(B2:B8) counts anything that is not empty and returns 6. When those two disagree, one cell is text. Look for a left-aligned number or a small green triangle in the corner, or test a cell with =ISNUMBER(B5), which returns FALSE here.

To fix it for good, select the column and use Data > Text to Columns > Finish, or click the warning icon and choose Convert to Number. To total the column as it is, =SUMPRODUCT(--B2:B8) returns 1770: the double minus turns “45” into 45 and the empty cell into 0. In Microsoft 365, =SUM(--B2:B8) does the same.

Hidden rows and filters: SUM, SUBTOTAL 9 and 109

SUM adds every cell in the range, visible or not. When you filter a list or hide a few rows, the total does not move. SUBTOTAL is the function that reacts, and its first argument decides how far it goes. Starting from the same list (SUM = 1725):

Situation=SUM(B2:B8)=SUBTOTAL(9,B2:B8)=SUBTOTAL(109,B2:B8)
Nothing hidden172517251725
Row 3 (Groceries, 340) hidden by right-click > Hide172517251385
Filter on, Rent (1200) filtered out1725525525

Filtered-out rows are always left out by SUBTOTAL; the difference between 9 and 109 is only about rows you hide by hand. If you are not sure which you need, use 109: it matches what is on screen. Clicking Total Row in an Excel Table inserts SUBTOTAL(109,...) for you.

Excel SUM vs SUBTOTAL 9 and 109 with hidden rows and filters
SUBTOTAL 109 skips hand-hidden rows; both 9 and 109 skip filtered rows

If the range holds an error, SUM and SUBTOTAL both show it. Put #N/A in B7 and =SUM(B2:B8) becomes #N/A. =AGGREGATE(9,6,B2:B8) ignores the error and returns 1725; change 6 to 7 to skip errors and hidden rows together. Fix the error at its source when you can, because a hidden error usually means a broken lookup somewhere else.

Everyday SUM formulas

GoalFormulaNote
Running total=SUM($B$2:B2) in C2, filled downGives 1200, 1540, 1600, 1600, 1685, 1685, 1725. The start is locked with $, the end moves.
Same cell on several sheets=SUM(Jan:Mar!B9)Adds B9 on Jan, Mar and every sheet between them. Moving a sheet outside that span drops it from the total.
Whole column=SUM(B:B)Picks up new rows automatically. Never put this formula inside column B, or you get a circular reference.
Several blocks=SUM(B2:B8,D2:D8)Commas separate the blocks. A space instead of a comma means “the overlap” and usually returns #NULL!.
Only some items=SUMIF(A2:A8,"Rent",B2:B8)Returns 1200. Use SUMIFS for two or more conditions.
Rounded parts=SUM(ROUND(B2:B4,2))Adds the values as they are shown. Needs Microsoft 365, or SUMPRODUCT in older versions.

For a quick look without a formula, select the cells and read the status bar at the bottom of the window. It shows Sum, Count and Average for the selection, and it only adds visible cells, which is a handy way to double-check a SUBTOTAL.

When the total is off by a little

Put 1.333 in three cells and format them with one decimal place. Each shows 1.3, so you expect 3.9. SUM shows 4.0, because it adds the stored 3.999 and only the display is rounded. The total is right; the visible parts are not. If the printed parts must add up, round the values themselves with =ROUND(...,1) or total them with =SUM(ROUND(B2:B4,1)), which returns 3.9.

Checklist when an Excel SUM total looks wrong
Six checks before you trust a SUM total

Careful: a total that shows 0 is almost always a column of numbers stored as text, and a total that never changes when you edit a cell usually means calculation is set to Manual. Check Formulas > Calculation Options and switch it back to Automatic.

Google Sheets uses the same =SUM(B2:B8) and also skips text in ranges, so the coffee problem looks the same there. SUBTOTAL with 9 and 109 and the double minus trick work as well. Sheets has no AGGREGATE; wrap the range in IFERROR instead, as in =SUM(ARRAYFORMULA(IFERROR(B2:B8,0))).

Frequently asked questions

Why is my SUM formula returning 0?

The numbers are stored as text, so SUM skips every one of them. Compare =COUNT(range) with =COUNTA(range) to confirm, then convert the column with Text to Columns or Convert to Number.

What is the shortcut for SUM in Excel?

Alt + = on Windows inserts AutoSum with a suggested range. Check the highlighted range before pressing Enter, because AutoSum stops at the first empty cell.

How do I sum only visible cells after filtering?

Use =SUBTOTAL(109,B2:B8). It leaves out filtered rows and rows you hid by hand. SUM always adds everything in the range.

How many numbers can the SUM function add?

Up to 255 arguments. Each range counts as one argument, so a single range can hold as many cells as the sheet allows.

How do I sum a column that contains an error?

Use =AGGREGATE(9,6,B2:B8), which adds the numbers and ignores error values. In Google Sheets, use =SUM(ARRAYFORMULA(IFERROR(B2:B8,0))).

Sources: Last checked November 2026. Microsoft Support: SUM function, SUBTOTAL function, AGGREGATE function; Google: SUM in Google Sheets.

광고

#ExcelSUM  #SUMFunction  #AutoSum  #ExcelFormulas  #SUBTOTAL  #RunningTotal  #ExcelTips  #ExcelErrors  #GoogleSheets  #MetaTrend

Found this useful? Share it.