How to Sort Subtotals in Excel

In this tutorial, you will learn how to add and sort subtotals in Excel.

 

sort subtotals excel 2a

 

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 structure:

 

sort subtotals initial data-1a

 

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).

1. Click on any cell in the data range, and in the Ribbon, go to Data > Subtotal.

 

insert subtotal excel 1a

 

2. In the Subtotal window, (1) choose Product in the At each change in drop-down list. (2) In the Add subtotal to list, select Total Sales, and (3) click OK.

 

insert subtotal excel 2

 

Now subtotals are added for each product.

3. Collapse the groups by clicking on the 2 (the outline bar number), so only the subtotals are displayed.

 

subtotals collapse excel 1a

 

4. To sort subtotals, click on any Total Sales value in Column G, and in the Ribbon, go to Home > Sort & Filter > Sort Largest to Smallest.

 

sort subtotals excel 1

 

As a result, all subtotals all sorted in descending order.

 

sort subtotals excel 2a