PivotTables: grouping that works: practice exercises
Group Selection, groups you choose (North = Leeds and York), renaming a group, Ungroup, years and quarters together, number bands. 8 exercises on real-looking data, each checked as you go. The full lesson is part of Pro.
This lesson has a PivotTable builder like Excel's: drag fields into Rows, Columns and Values, and each task is checked as you go.
How it works
A PivotTable can add items together into groups you choose. Select the items: click one, then Ctrl+click the others. Then choose Group Selection on the PivotTable Analyse tab (Pivot Table Analyse on a Mac), or right-click (or Control-click) and choose Group. Excel makes a new field, such as Site2, with the group in it.
Rename a group by typing over its name. Ungroup takes a group apart again. Dates and numbers group in a different way: by years, quarters and months, or into bands such as 0-999.
Group items you choose
Leeds sold £6,200 and York £4,100, so the North sold £6,200 + £4,100 = £10,300.
| Row Labels | Sum of Sales (£) |
| Derby | 5000 |
| Derby | 5000 |
| Group1 | 10300 |
| Leeds | 6200 |
| York | 4100 |
| Nottingham | 7000 |
| Nottingham | 7000 |
| Grand Total | 22300 |
Click Leeds in the PivotTable, then Ctrl+click York. Then PivotTable Analyse, Group Selection, or right-click (or Control-click) and choose Group.
Excel adds a field called Site2 outside Site. Group1 shows its total, £10,300, at the top. Each site you didn't pick, like Derby, is a group of its own.
Rename it, then tidy up
Click the Group1 cell, type North and press Enter. The new name is kept when the data changes and you Refresh.
| Row Labels | Sum of Sales (£) |
| Derby | 5000 |
| North | 10300 |
| Nottingham | 7000 |
| Grand Total | 22300 |
Filters
Columns
Rows
Values
To see just the groups, untick Site in the field list, leaving Site2 in Rows. Group the other sites too (Derby and Nottingham as Midlands, say) and you get one line for each area.
Ungroup
Grouped the wrong sites? Click the group's name, such as North, then PivotTable Analyse, Ungroup (or right-click or Control-click it, then Ungroup). Its sites go back to being on their own.
When the last group goes, Excel takes the Site2 field away too. Clicking a site that isn't in a group and choosing Ungroup does nothing, as there's no group to undo.
Dates and numbers
Two years of orders: the PivotTable can show 2025, then Qtr1 to Qtr4 under it, then 2026. Right-click (or Control-click) a date in Excel and choose Group, then pick Years and Quarters. On this sheet those choices are in the Date field's Field Settings.
Numbers go into bands: Starting at 0 and By 1000 gives 0-999, 1000-1999 and so on. An order of £1,450 goes in 1000-1999.
What you'll practise
- Bradford and Sheffield are the two northern sites. Group them in the PivotTable: click Bradford, Ctrl+click Sheffield, then Group Selection.
- Group Bradford and York together, then rename the group North.
- The area manager wants two areas: North (Bradford and York) and Midlands (Leicester, Lincoln and Nottingham). Make both groups and name them.
- The sites are grouped into North and Midlands. Now show just one line for each area, with no sites under them.
- Someone grouped Leicester into North by mistake: North should be Sheffield and York. Select North and Ungroup it, then make the North group again.
- The café owner wants just two lines: Drinks (Cappuccino, Hot chocolate, Tea) and Food (Flapjack, Soup, Toastie). Make a PivotTable of the sales by product, group them, name the groups, and leave only the two groups in Rows.
- The orders cover two years. Show the sales for each quarter of each year: Date in Rows, grouped by Years and Quarters but not months.
- How many orders were small, medium or large? Count the orders in bands of £1,000 of Sales (£), starting at 0 (0-999, 1000-1999 and so on). Put Region in Values to count them.