How to Sort Subtotals in Excel

Written by

Editorial Team

Reviewed by

Laura Tsitlidze

Last updated on May 22, 2023

This tutorial demonstrates 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.

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. With any cell in the data range selected, and in the Ribbon, go to Data > Subtotal.

insert subtotal excel 1a

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

insert subtotal excel 2

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

subtotals collapse excel 1a

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

sort subtotals excel 1

The result is all subtotals sorted in descending order.

sort subtotals excel 2a

AI Formula Generator

Try for Free

See all How-To Articles