If Excel's Subtotal feature isn't working, it's usually because the data isn't set up as a proper table, the subtotal function is being applied to the wrong range, or the SUBTOTAL function's first argument (the function number) is wrong. The quickest fix is to convert your data to a table (select the range, then press Ctrl+T) and reapply Subtotal from the Data tab. Below are the exact steps to diagnose and fix the problem, plus common mistakes and troubleshooting tips.
What You'll Need
- Microsoft Excel (any recent version; steps apply to Windows and Mac, though menu labels may differ slightly by version and region).
- A dataset with a header row and no blank rows or columns within the data range.
- Basic familiarity with selecting ranges and using the Data tab.
Step-by-Step
- Check that your data is contiguous. Select any cell in your data and press Ctrl+A (or Command+A on Mac). If Excel selects only part of your data, you have blank rows or columns breaking the range. Remove or fill those blanks, or manually select the entire range including headers.
- Convert your range to an Excel Table (recommended). With a cell selected in your data, press Ctrl+T (Command+T on Mac). Confirm the range and that “My table has headers” is checked, then click OK. Tables automatically expand and keep subtotals working when you add rows.
- Sort your data by the column you want to group on. The Subtotal feature inserts a subtotal each time the value in the chosen column changes. If the data isn't sorted, you'll get repeated subtotals for the same group. Select the column you want to group by (e.g., Region) and use Data > Sort A to Z or Z to A.
- Apply the Subtotal command. Go to the Data tab and click Subtotal (in the Outline group). In the dialog:
- Set “At each change in” to the column you sorted by.
- Set “Use function” to Sum (or Count, Average, etc.).
- Under “Add subtotal to”, check the numeric column(s) you want totaled.
- Ensure “Replace current subtotals” is checked if you're reapplying, and “Summary below data” is checked to place subtotals below each group.
- Verify the subtotal rows appear. You should see a new row after each group with the word “Total” (or the function name) and the calculated value. If nothing happens, check that the column you're subtotaling contains numbers, not text that looks like numbers (see Troubleshooting).
- Use the SUBTOTAL function manually if the command fails. In a blank cell below your data, type
=SUBTOTAL(9, range)where 9 represents SUM (use 1 for AVERAGE, 2 for COUNT, 3 for COUNTA, 4 for MAX, 5 for MIN, etc.). The range should be the cells you want to total. This function ignores other SUBTOTAL results and filtered-out rows, making it more reliable than SUM in filtered lists. - Test with a filter. Apply a filter (Data > Filter), then filter out some rows. A SUBTOTAL formula will recalculate to show only visible rows, while a plain SUM will not. If your subtotals don't update when filtering, you likely used SUM instead of SUBTOTAL.
Common Mistakes
- Not sorting first. The Subtotal command groups by changes in value. Without sorting, identical groups are scattered, producing many small subtotals instead of one per group.
- Using SUM instead of SUBTOTAL. SUM includes hidden or filtered rows, so totals look wrong after filtering. SUBTOTAL (function numbers 1–11) ignores filtered rows; use 101–111 to also ignore manually hidden rows.
- Blank rows or columns inside the data. These break the range and cause the Subtotal command to treat only part of the data. Remove blanks or convert to a table.
- Numbers stored as text. If subtotals return 0, the values may be text. Check with
=ISNUMBER(cell); convert using Text to Columns or by multiplying by 1. - Subtotal applied to the wrong column. In the dialog, “Add subtotal to” must have the numeric column(s) checked; otherwise, no values are summed.
- Existing subtotals not replaced. If you reapply without checking “Replace current subtotals”, you'll get nested or duplicate subtotal rows.
Tips
- Use Excel Tables (Ctrl+T) instead of plain ranges—they auto-expand and keep subtotals consistent.
- To subtotal only visible rows after filtering, use the SUBTOTAL function with function numbers 1–11 (or 101–111 to ignore manually hidden rows).
- Press Ctrl+Shift+L to toggle filters quickly; subtotals recalculate automatically when you filter.
- If you need multiple levels of subtotals, apply the Subtotal command once, then repeat with a different “At each change in” column and uncheck “Replace current subtotals”.
- Use the outline symbols (1, 2, 3) at the left to collapse or expand groups for a cleaner view.
Troubleshooting
If subtotals still don't work, work through these checks in order:
- Subtotal command greyed out? Ensure you have a continuous range selected and that the workbook isn't protected. Go to Review > Unprotect Sheet if needed.
- Subtotals show 0 or blank? Check that the column you're subtotaling contains numbers, not text. Select the column, go to Data > Text to Columns, and click Finish to convert. Alternatively, use
VALUE()or multiply by 1 in a helper column. - Subtotals don't update when filtering? You likely used the SUM function instead of SUBTOTAL. Replace with
=SUBTOTAL(9, range). - Subtotal rows appear in wrong places? The data isn't sorted by the group column. Sort ascending or descending, then reapply Subtotal with “Replace current subtotals” checked.
- Error message “Cannot use SUBTOTAL with a 3-D reference”? SUBTOTAL doesn't work across multiple sheets. Use separate SUBTOTAL formulas per sheet, then sum those results.
- Still stuck? Save your work, close and reopen Excel, or try the same steps in a new workbook to rule out file corruption.
Frequently Asked Questions
Why is the Subtotal button greyed out?
It's usually because your data range isn't contiguous or the sheet is protected. Select the entire range including headers, and unprotect the sheet via Review > Unprotect Sheet.
Can I use Subtotal with filtered data?
Yes—use the SUBTOTAL function (not SUM) with function numbers 1–11. It automatically ignores rows hidden by filters.
What's the difference between SUBTOTAL and SUM?
SUBTOTAL ignores rows hidden by filters (and optionally manually hidden rows), while SUM includes all rows in the range. Use SUBTOTAL for filtered lists.
How do I remove subtotals?
Select the data, go to Data > Subtotal, and click Remove All. This deletes all subtotal rows and outline groups.
Why do my subtotals show the wrong total?
Check that you're subtotaling the correct column and that the data is sorted by the group column. Also verify that numbers aren't stored as text.
Can I subtotal by multiple columns?
Yes—apply the Subtotal command once, then repeat with a different “At each change in” column, unchecking “Replace current subtotals” each time.