Microsoft Excel Subtotals

How to Insert Subtotals in Excel

by on February 4, 2011

in Excel,Microsoft Office Training,Online Training

The Subtotal tool in the Outline group on the Data tab of the ribbon automatically inserts subtotal formulas and grand totals for a column or columns. The subtotals can be SUM’s, AVERAGE’s, COUNT’s, MIN, MAX and more.

The Subtotal tool can give you valuable information in a few clicks, transforming your data like this:

Microsoft Excel Subtotal Before Microsoft Excel Subtotal After

How to Format Your Data to Work With Subtotals

First make sure your data is laid out in a sorted table; i.e. the columns you want your subtotal based on must be sorted, like in the example below column A & B are sorted. It must also have column labels, also called a header row, and no blank rows or columns.

How to Insert a Subtotal

Using the data below we’re going to insert a subtotal that SUM’s the ‘Jumps’ column at every change in the ‘Solar System’.

Excel Subtotal Columns

First select a cell anywhere in your table.  Then on the Data tab in the Outline group, select Subtotal.

The window below will open.

Microsoft Excel Subtotal window

1.       Here you can select the column you want your subtotals based on by choosing from the ‘At each change in:’ list. We’ll select ‘Solar System’.

2.       Select what type of subtotal you want inserted in the ‘Use function:’ list. You can choose from SUM, AVERAGE, COUNT, MIN, MAX and a few more. We’re going to select SUM.

3.       In the ‘Add subtotal to:’ list you can select which columns you want subtotals inserted. We’ll select ‘Jumps’ but we could also select the ‘Duration’ column as this has values that can be summed.

4.       You can then select from the check boxes:

  • Replace current subtotals: Handy if you’ve already inserted subtotals but you want to change them.
  • Page break between groups: Useful for printing your data.
  • Summary below data: This inserts the subtotals at the bottom of each change in data. Un-checking this inserts it at the top.

5.       Click OK

Our table now looks like this:

Microsoft Excel Subtotal data

You can see the Subtotals have been inserted at the bottom of each change in Solar System and notice now you have some new buttons added to the side bar on the left.

These buttons allow you to hide and unhide the detail rows. You can either click the outline symbols Microsoft Excel Subtotal level buttons or the + and symbols to expand and contract the rows.

Clicking on level 2 shows the Subtotal rows only, like this:

Microsoft Excel Subtotals hidden

Or you can click on the + and buttons to hide and unhide individual subtotals.

Clicking on level 1 shows the Grand Total only.

How to Nest Subtotals

Taking the example above, let’s say we want to add a subtotal at each change in the Bid column so that we have a subtotal for the ‘Buy’ items and a subtotal for the ‘Sell’ items.

To do this we follow steps 1 to 3 above, and we un-tick the ‘Replace current subtotals’ check box like this so that our subtotals are added to the table:

Microsoft Excel how to nest Subtotals

Now our table looks like this:

Microsoft Excel nested Subtotals

You can see we’ve now got 4 levels in our outline, and we have additional subtotals inserted in the Bid column to total the Buy and Sell items.

We can keep on nesting subtotals and also change the function thus adding more levels to your outline. For example we’ll add at COUNT to our Bid Column like this:

Microsoft Excel nested Subtotals

And now our table has 5 outline levels and looks like this:

Microsoft Excel multiple=

NOTE: I’ve added this fifth level for demonstration purposes, however bear in mind that there will come a time where your table is simply too busy and other methods of summarising your data would be better.

TIPS:

1.       The subtotals are actually formulas and therefore recalculate as you edit the data in your table. Assuming your workbook is set to automatically recalculate.

2.       The grand totals are calculated from the detail data, not the subtotals. Therefore if you insert an Average the grand total will calculate the average for all of the data.

Download the practice workbook here.

FREE PDF Download
100 Excel Tips & Tricks

Excel Tips & Tricks E-Book
Just enter your details below

Leave a Comment

Previous post:

Next post: