Start with the status bar for a quick check
Select the cells you want to total. Look at the status bar along the bottom of the Excel window. By default it shows the sum, the average and the count of the selected cells, and nothing is written into the sheet. If those figures are missing, right-click the status bar and turn on the ones you want.
This is handy for a quick check. The figure disappears as soon as you select something else, so use a formula when the total needs to stay in a report.
Add a column with AutoSum
Click the empty cell directly below a column of numbers. On the Home tab, in the Editing group, select AutoSum. Excel suggests a range and fills in a SUM formula. Check that the range is right, since AutoSum sometimes picks up the wrong cells, then press Enter. On Windows you can also press Alt and the equals sign together.
Total a range with SUM
The SUM function adds up the numbers you give it:
=SUM(B2:B20)
You can add several ranges or single cells, separated by commas: =SUM(B2:B20, D2:D20, 150).
SUM skips text and empty cells inside a range, so a range with text in it still calculates. The downside is that a number Excel is storing as text drops out of the total without any warning. The section on totals that look wrong covers how to find those.
Count cells with COUNT, COUNTA and COUNTBLANK
Three functions count cells, and each answers a different question.
- COUNT counts cells that contain numbers. Dates count too, because Excel stores them as numbers:
=COUNT(B2:B50) - COUNTA counts cells that are not empty, whatever they contain, including text:
=COUNTA(A2:A50) - COUNTBLANK counts the empty cells in a range:
=COUNTBLANK(C2:C50)
A common surprise is using COUNT on a list of names and getting 0. Names are text, so COUNT skips them. Use COUNTA for text. Also note that a formula returning an empty string counts as not empty to COUNTA but as blank to COUNTBLANK, so the two can disagree on cells that look empty.
Total or count only the rows that match
Most real questions ask for a total of some rows, not all of them. Excel has a family of functions for this:
- SUMIF adds numbers where one condition is met.
- SUMIFS adds numbers where several conditions are all met.
- COUNTIF counts cells that meet one condition.
- COUNTIFS counts rows that meet several conditions.
- AVERAGEIF averages the numbers that meet a condition.
- SUMPRODUCT multiplies arrays and adds up the results, which helps when the logic gets more involved.
If you only have one condition, the walkthrough on how to use sumif in excel covers the most common case. For two or more conditions, the logic in sumifs with multiple criteria in excel is the next step. Counting rows instead of adding them follows the same pattern, as shown in how to use countif in excel and countifs with two conditions in excel. For averages, the same idea applies, and an averageif formula in excel example shows the details.
Sum only the visible rows
SUM includes rows that are hidden or filtered out. To total only the rows you can see, use SUBTOTAL with function number 109:
=SUBTOTAL(109, C2:C200)
Rows removed by a filter are always left out. Code 109 also leaves out rows you hid by hand, while the plain SUM code, 9, still counts those. For more on the difference, see how to sum only visible cells in excel.
Count unique values
Counting distinct entries is a different job from counting cells. In Excel 2021 or Microsoft 365, this formula does it:
=COUNTA(UNIQUE(FILTER(A2:A100, A2:A100<>"")))
The FILTER part removes blank cells first, so they are not counted as a value. Older versions need a different approach, which is covered in how to count unique values in excel.
Totals that look wrong
When a total is lower than you expect, or shows 0, check these first:
- Numbers stored as text. These often sit left-aligned in the cell and may have a small green triangle in the corner. Select the cells, click the warning icon, and choose Convert to Number.
- Calculation set to manual. On the Formulas tab, open Calculation Options and choose Automatic. In manual mode, press F9 to recalculate.
- A cell formatted as Text. A formula typed into a Text-formatted cell shows as text instead of calculating. Change the format to General, then press F2 and Enter.
- Show Formulas switched on. The sheet shows formulas instead of results. Turn it off on the Formulas tab, or press Ctrl plus the grave accent key, which sits above Tab.
For more causes, see why does sum show 0 in excel.
Which function to use
| If you want to | Use |
|---|---|
| Add up a column | SUM |
| Count cells that contain numbers | COUNT |
| Count cells that are not empty | COUNTA |
| Count empty cells | COUNTBLANK |
| Add up rows that match one condition | SUMIF |
| Add up rows that match several conditions | SUMIFS |
| Count rows that match one condition | COUNTIF |
| Count rows that match several conditions | COUNTIFS |
| Average rows that match a condition | AVERAGEIF |
| Multiply pairs of values and add them | SUMPRODUCT |
| Total only the rows you can see | SUBTOTAL with code 109 |
If you keep building similar totals by hand, a pivot table can group and total the data without writing formulas. The basics are in what is a pivot table in excel.