Automatic Subtotals in Excel
January 21, 2005
Today we have a list of sales by store. You need to add a subtotal for each store. This is fairly easy to do. Sort the data by store. Go to the first row of data from the next store and select Insert - Row.
![](/img/tech-tv/mec05020800.jpg)
Type a label in column A indicating that this is Store 100 Total. In cell C14, select Alt+Equals to put in a sum formula.
![](/img/tech-tv/mec05020801.jpg)
Drag the fill handle (the square dot in the lower right corner of the cell pointer) to the right to copy the formula over to column D.
![](/img/tech-tv/mec05020802.jpg)
This is not hard. It takes maybe 20 seconds per store. However - if you have 250 stores, it will take a really boring 75 minutes to add all of those totals. Luckily, there is an easier way!
Select a single cell in your data. From the menu, select Data - Subtotals. The following dialog box will be displayed.
![](/img/tech-tv/mec05020803.jpg)
The Subtotals dialog offers to insert subtotals every time that the Store changes. By default, the final column is checked in the Add Subtotal To: section. I also checked units. Click OK. In less than 15 seconds, Excel has inserted hundreds of subtotals for you!
![](/img/tech-tv/mec05020804.jpg)
You can also use this feature to do multiple subtotals. Be sure to start at the higher level first. If you wanted subtotals by province and store, first add them for the province.
![](/img/tech-tv/mec05020805.jpg)
Then, select Data - Subtotals again. This time, uncheck the box for "Replace Current Subtotals". Change the top dropdown from Province to Stores.
![](/img/tech-tv/mec05020806.jpg)
The result - subtotals are added for each store and province.
Look to the left of column A. There are new buttons there labeled 1, 2, 3... These are called the Group & Outline buttons. If you choose button 2, you will see just the province subtotals.
![](/img/tech-tv/mec05020808.jpg)
If you choose the #3 group and outline button, you will see all of the subtotals.
![](/img/tech-tv/mec05020809.jpg)
The automatic subtotal feature has been around since Excel 97, but it is often overlooked. In the case like today, it can turn a boring 1-hour+ process into a few seconds of work.