How to Fix Excel Subtotals Not Calculating Correctly
Question details
The user needs to fix an issue where Excel Subtotals are either calculating incorrectly or separating identical-looking account values into multiple groups instead of consolidating them.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Applying the Subtotal feature to summarize and group data by specific fields, such as Cost Element.
- Observed behavior
- Subtotals fail to calculate properly, often creating separate subtotal groups for what appear to be identical account values due to sorting failures, hidden spaces, or inconsistent cell formatting.
Before reapplying subtotals, ensure your dataset does not contain any entirely blank rows or columns, and temporarily turn off any active filters to ensure all data is visible during the sorting process.
Sort the Data Before Applying Subtotals
Excel requires data to be sorted by the grouping field for the Subtotal feature to work properly and group items together.
The most common reason for subtotals creating multiple separate groups for the same value is that the data was not sorted correctly before applying the subtotal. Excel processes subtotals row by row and will start a new group every time the value in the specified column changes.
Select any cell in your data range, go to the Data tab, click on Subtotal in the Outline group, and then click 'Remove All'.
Select the column you want to group by (e.g., Cost Element). Go to the Data tab and click the 'Sort A to Z' or 'Sort Z to A' button to organize the identical values together.
With the sorted data selected, click Subtotal again. In the 'At each change in' dropdown, choose your sorted column, select your preferred function, and click OK.

Clean Data for Hidden Spaces and Formatting
If identical values are still grouped separately after sorting, they likely contain hidden spaces or inconsistent formatting that Excel reads as distinct values.
Calculate Subtotals Seamlessly in WPS Office
WPS Spreadsheet provides a highly compatible and intuitive interface for managing, sorting, and calculating subtotals. It automatically handles complex datasets with ease, allowing you to organize your data effectively.
- 1. Open your dataset: Launch WPS Spreadsheet and open your workbook.
- 2. Sort your column: Highlight the column you wish to group by and sort it alphabetically or numerically via the Data tab.
- 3. Apply Subtotal: Click 'Subtotal' in the Data tab, select your calculation preferences from the dialog box, and click OK to instantly generate accurate group summaries.

Frequently Asked Questions
Why is the Subtotal button grayed out in Excel?
The Subtotal feature cannot be used if your data is currently formatted as an Excel Table. You must first convert it back to a standard range. To do this, right-click anywhere inside the table, point to 'Table', and select 'Convert to Range'.
How do I copy only the subtotal summary rows without the detailed data?
First, use the outline symbols (1, 2, 3) on the left side of the screen to collapse the data so only the subtotals are visible. Select the visible rows, press Alt + ; (semicolon) to select visible cells only, then copy (Ctrl + C) and paste (Ctrl + V) them to your new location.
Can I add multiple subtotals to the same dataset?
Yes. You can nest subtotals by adding a primary subtotal, and then adding a secondary one. When you click Subtotal the second time to add the nested calculation, ensure you uncheck the 'Replace current subtotals' box before clicking OK.




