How to Sort Subtotals in Excel
Written by
Reviewed by
Last updated on May 22, 2023
This tutorial demonstrates how to add and sort subtotals in Excel.
Sort Subtotals
To sort by subtotal, start by adding subtotals to the data. Once the data has subtotals, they can be sorted while maintaining the data structure and keeping grouped data together.
Say you have the following data.
You want to create a subtotal (by Total Sales in Column G) for every Product in Column C so you can sort by sales of each product without losing any of the detail. The prerequisite is that you have data sorted in a column that you are grouping (Product).
- With any cell in the data range selected, and in the Ribbon, go to Data > Subtotal.
- In the Subtotal window, choose Product in the At each change in drop down. Then, in the Add subtotal to list, tick Total Sales. Click OK.
- Now subtotals are added for each product. Collapse the groups by clicking on the 2 (the outline bar number) so only the subtotals are displayed.
- To sort subtotals, select any Total Sales value in Column G, and in the Ribbon, go to Home > Sort & Filter > Sort Largest to Smallest.
The result is all subtotals sorted in descending order.