How to Get Group Totals in Excel: Step-by-Step
In this article
To get group totals in Excel, use the SUBTOTAL function with function number 109 (SUM) and reference the data column; it totals only visible rows and ignores rows hidden by filters. For a one-click solution, convert your range to an Excel Table (Ctrl+T) and use the Table Design > Total Row option, which adds a total row that updates with filters. For grouped totals by category, use SUMIF or a PivotTable. Below are the exact steps for each method, plus what to do when totals look wrong.
What You'll Need
- Excel 2016 or later (desktop) or Excel for Microsoft 365; the steps also work in Excel for Mac with minor menu differences.
- A dataset with a header row and at least one numeric column to total.
- Optional: a separate column containing the group labels (e.g., Region, Category) if you want totals per group.
Step-by-Step
Method 1: Total visible rows with SUBTOTAL (best for filtered lists)
- Click the cell where you want the total to appear, typically directly below the numeric column.
- Type
=SUBTOTAL(109,and then select the range of numbers you want to total (for example,C2:C100). Close the parenthesis and press Enter. The formula should look like=SUBTOTAL(109,C2:C100). - Apply filters to your data (select the header row, then Data > Filter). As you filter, the SUBTOTAL result recalculates to show only the visible rows.
- If you need totals for multiple numeric columns, copy the formula across or repeat for each column.
Note: Function number 9 also sums visible rows but includes manually hidden rows; 109 excludes both filtered and manually hidden rows. Use 109 when you want the total to reflect only what is currently shown.
Method 2: Use an Excel Table with a Total Row
- Select any cell inside your data range.
- Press Ctrl+T (Windows) or Command+T (Mac) to create a table. Confirm the range and that “My table has headers” is checked, then click OK.
- With the table selected, go to Table Design on the ribbon and check Total Row. A new row appears at the bottom with a drop-down in each column.
- In the numeric column’s total cell, click the drop-down and choose Sum. The total updates automatically when you filter the table.
This method is the fastest for ongoing use because the total row stays with the table and adjusts as rows are added or filtered.
Method 3: Totals by group using SUMIF
- List the unique group names (e.g., North, South, East) in a separate area, one per row.
- Next to the first group name, type
=SUMIF(and select the range containing the group labels (e.g.,A2:A100). Type a comma. - Click the cell containing the group name you are totaling (e.g.,
E2), then type a comma. - Select the range containing the numbers to sum (e.g.,
C2:C100). Close the parenthesis and press Enter. The formula looks like=SUMIF(A2:A100,E2,C2:C100). - Copy the formula down for the remaining group names. Each row now shows the total for that group.
If you need to sum based on multiple conditions, use SUMIFS instead, which accepts additional range/criteria pairs.
Method 4: PivotTable for grouped totals
- Select any cell in your data and go to Insert > PivotTable. Choose New Worksheet and click OK.
- In the PivotTable Fields pane, drag the group column (e.g., Region) to the Rows area.
- Drag the numeric column you want to total to the Values area. Excel will default to Sum; if it shows Count, click the field in Values, choose Value Field Settings, and select Sum.
- Apply filters or slicers as needed; the PivotTable totals update automatically.
Common Mistakes
- Using SUM instead of SUBTOTAL on filtered data. SUM totals all rows, including hidden ones, so your filtered total will be wrong. Use SUBTOTAL(109, …) instead.
- Forgetting to lock ranges. When copying a SUMIF formula down, the criteria range and sum range should be absolute (e.g.,
$A$2:$A$100) so they don’t shift. Press F4 to add dollar signs. - Including the header row in the range. SUMIF and SUBTOTAL ignore text, but including headers can cause confusion; select only data rows.
- Manually hiding rows and expecting SUBTOTAL(9) to ignore them. Function 9 includes manually hidden rows; use 109 to exclude them.
- Adding a Total Row to a range that isn’t a table. The Total Row option only appears for Excel Tables. Convert the range first (Ctrl+T).
Tips
- Use Excel Tables (Ctrl+T) for any list you will filter or add to; totals and formulas auto-expand.
- Name your ranges (Formulas > Define Name) to make SUMIF formulas easier to read and maintain.
- For quick totals without formulas, select the numbers and look at the Status Bar at the bottom of the Excel window; it shows Sum, Average, and Count for the selection.
- To total filtered data in a PivotTable, add a slicer (PivotTable Analyze > Insert Slicer) instead of filtering the source data.
- If you need a running total within groups, use SUMIF with a mixed reference (e.g.,
=SUMIF($A$2:A2,A2,$C$2:C2)) and copy down.
Troubleshooting
- Total shows 0 or blank: Check that the numbers are stored as numbers, not text. Select the column, then Data > Text to Columns > Finish to convert. Also verify the criteria in SUMIF matches exactly (no extra spaces).
- SUBTOTAL not updating after filter: Ensure calculation is set to Automatic (Formulas > Calculation Options > Automatic). Also confirm you used 109, not 9, if rows are manually hidden.
- Total Row missing: The table may have been converted to a range. Select the range and press Ctrl+T again, then re-enable Total Row.
- PivotTable shows Count instead of Sum: The values column likely contains text or blanks. Clean the data, then in the PivotTable, right-click a value and choose Summarize Values By > Sum.
- Formula returns #VALUE!: Check that all ranges in SUMIF are the same size. Mismatched ranges cause errors.
Frequently Asked Questions
What is the difference between SUM and SUBTOTAL?
SUM adds all numbers in a range, including hidden rows. SUBTOTAL can ignore filtered or manually hidden rows depending on the function number (109 ignores both). Use SUBTOTAL when you filter.
Can I get group totals without a PivotTable?
Yes. Use SUMIF or SUMIFS with the group column as the criteria range, or use the Subtotal feature (Data > Subtotal) to insert automatic group totals with outline levels.
Why does my SUBTOTAL show a different number than the Status Bar?
The Status Bar shows the sum of selected cells, including hidden ones. SUBTOTAL(109) excludes hidden rows, so the numbers can differ when rows are filtered or hidden.
How do I total only visible cells in a filtered table?
Use SUBTOTAL(109, range) or add a Total Row to the table and choose Sum. Both ignore filtered-out rows.
Can I use SUBTOTAL with multiple columns?
Yes. Place a SUBTOTAL formula in each column’s total cell, or select multiple total cells and press Alt+= (AutoSum) after filtering; Excel inserts SUBTOTAL formulas automatically.
What if my group labels have trailing spaces?
SUMIF treats “North” and “North ” as different. Use TRIM to clean labels, or use wildcards like *North* in the criteria (though wildcards may match unintended groups).