Calculate data by inserting subtotals and totals
- 1Sort the data by the column to group on: Shop.
- 2Select a cell in the data. Data › Subtotal.
- 3At each change in: Shop. Use function: Sum. Add subtotal to: Sales. OK.
- 4Use the outline level buttons 1, 2 and 3 to show more or less detail.
Subtotal inserts a total row under each group and a grand total at the end, and outlines the sheet so the detail folds away.
What the MO-211 task asks
One of our ten MO-211 practice exams has it, as a pair of tasks: “This sheet is already sorted by Route. Use Data > Subtotal to insert a SUM of Takings at each change in Route,” then “Collapse the subtotal outline to level 2 so only the route totals and the grand total show.”
Our grader counts the subtotal rows, one for each route, and then checks that the detail rows are hidden. Collapsing to the wrong level fails the second task.
“Totals” also covers a table's Total Row (Table Design › Total Row), which works the same way: its total ignores rows a filter hides.
Worked examples
Set up the grid below to follow along. Each example starts from it as shown; every result is what Excel showed.
| A | B | C | |
|---|---|---|---|
| 1 | Shop | Item | Sales |
| 2 | East | Tea | 40 |
| 3 | East | Jam | 25 |
| 4 | North | Tea | 30 |
| 5 | North | Oats | 15 |
| 6 | North | Jam | 20 |
| 7 | West | Tea | 35 |
- 1Select A2. Data › Subtotal: At each change in Shop, Use function Sum, Add subtotal to Sales. OK.
The sheet grows from 7 rows to 11. Each total is a SUBTOTAL formula with function number 9, the sum, over the rows above it.
- 1Select the outline level button 2.
Level 1 shows only the heading and the grand total; level 3 shows everything again.
- 1Data › Subtotal again: Use function Average, untick Replace current subtotals. OK.
With Replace current subtotals ticked, the averages would replace the sums instead.
- 1Run the same Subtotal on East, North, East, North, West.
Subtotal starts a new group every time the value changes, so sort first.
- 1Data › Subtotal › Remove All.
The total rows and the outline are removed together.
- 1Data › Subtotal: Shop, Sum, Sales. OK.
- 2Outline level button 2.
The first two examples, done in Excel on the same sheet.
Watch it done in Excel
The last example above, recorded in real Excel on the same grid.
Exam traps
On unsorted data, Subtotal makes a new group every time the value changes, so East gets two totals. Sort by the grouping column, then subtotal.
Subtotal is greyed out while the selection is in an Excel table. Convert the table to a range (Table Design › Convert to Range), or use the table's Total Row if the task asks for a total.
With it ticked, a second Subtotal removes the first set of totals. To keep the sums and add averages, untick it.
Level 1 hides the group totals as well as the detail. “Only the totals and the grand total” is level 2.
FAQ
What formula does Subtotal insert?
A SUBTOTAL formula in each total row: function number 9 for Sum, 1 for Average. The grand total uses the same function over all the detail rows, so it does not count the group totals twice.
What does a table's Total Row insert?
A SUBTOTAL formula with function number 109. Made into a table, the Sales grid's Total Row shows 165; filter the table to East and it shows 65.
How do I get rid of subtotals?
Data › Subtotal › Remove All. It removes the total rows and the outline together.
Try it under exam conditions
Take a full, timed MO-211 practice exam, upload the workbook you built, and get a score out of 1000 with a per-task breakdown of where the points went. Your first one is free.
No credit card needed.
