For teachers / Answer key
Answer key: PivotTables
For teachers. This page is kept out of search engines and linked only from the teachers page. Students can see the same answers in a lesson with Show answer. Any formula that gives the right values counts.
1. Your first PivotTable (Intermediate, 5 min)
Click any cell in the orders, then PivotTable in the toolbar. The data (
A1:F25) and the place for the PivotTable (H1) are filled in for you: click Create.H1PivotTable from A1:F25
In the PivotTable Fields panel, tick Region. Text fields go to Rows, so you get one row per region.
H1PivotTable from A1:F25 · Rows: Region
Now tick Sales. Numbers go to Values, where they are added up: Sum of Sales for each region, and a Grand Total.
H1PivotTable from A1:F25 · Rows: Region · Values: Sum of Sales
Same question, different angle: which product sells best? Drag Product from the field list onto the Rows area. It replaces Region.
H1PivotTable from A1:F25 · Rows: Product · Values: Sum of Sales
2. PivotTables: count, average and more values (Intermediate, 5 min)
What is a typical order worth in each region? Double-click the Sum of Sales heading in
I1and set Summarize by to Average.H1PivotTable from A1:F25 · Rows: Region · Values: Average of Sales
Add a second value: tick Units. It goes into Values next to the average, as Sum of Units.
H1PivotTable from A1:F25 · Rows: Region · Values: Average of Sales, Sum of Units
How many orders did each region take? Drag Product into Values. A text field in Values is counted.
H1PivotTable from A1:F25 · Rows: Region · Values: Average of Sales, Sum of Units, Count of Product
Finally, the biggest single order in units: double-click the Sum of Units heading in
J1and set Summarize by to Max.H1PivotTable from A1:F25 · Rows: Region · Values: Average of Sales, Max of Units, Count of Product
3. PivotTables: rows, columns and percentages (Intermediate, 5 min)
Click a cell in the PivotTable, then drag Product from the field list onto the Columns area.
H1PivotTable from A1:F25 · Rows: Region · Columns: Product · Values: Sum of Sales
Turn it around: products down the side, regions across the top. Drag Product onto Rows and Region onto Columns.
H1PivotTable from A1:F25 · Rows: Product · Columns: Region · Values: Sum of Sales
Which combinations matter most? Double-click Sum of Sales in the corner of the PivotTable (
H1) and set Show values as to % of Grand Total.H1PivotTable from A1:F25 · Rows: Product · Columns: Region · Values: Sum of Sales as % of Grand Total
4. PivotTables: sort, top 3 and filters (Intermediate, 5 min)
Rank the reps: click the ▾ on Row Labels in
H1and set Sort to Largest value first.H1PivotTable from A1:F25 · Rows: Rep · Values: Sum of Sales · Sorted largest first
Keep the podium only: in the same settings, set Show to Top 3.
H1PivotTable from A1:F25 · Rows: Rep · Values: Sum of Sales · Sorted largest first · Top 3
Now compare the North and South teams only: drag Region onto Filters. Then click the ▾ next to (All) at the top of the PivotTable, untick (All), and tick North and South.
H1PivotTable from A1:F25 · Filters: Region = North, South · Rows: Rep · Values: Sum of Sales · Sorted largest first · Top 3
5. PivotTables: dates by month and quarter (Intermediate, 5 min)
Click a cell in the PivotTable and tick Date. You get one row per order date: 24 rows.
H1PivotTable from A1:F25 · Rows: Date · Values: Sum of Sales
Click the ▾ on Row Labels in
H1and set Group dates by to Months.H1PivotTable from A1:F25 · Rows: Date (by month) · Values: Sum of Sales
Roll it up further: change Group dates by to Quarters.
H1PivotTable from A1:F25 · Rows: Date (by quarter) · Values: Sum of Sales
Finish the quarterly report: drag Region onto Columns.
H1PivotTable from A1:F25 · Rows: Date (by quarter) · Columns: Region · Values: Sum of Sales
6. GROUPBY and PIVOTBY: PivotTables as formulas (Advanced, 6 min)
In
I2, total the sales by region:=GROUPBY(B2:B25, F2:F25, SUM). The regions are the row field and the sales are the values.I2=GROUPBY(B2:B25,F2:F25,SUM)
Shows I2: East, J2: $5,321, I3: North, J3: $4,520, I4: South, J4: $3,629, and 4 more
In
I10, rank them instead: add sort_order as the sixth argument.-2means "by the 2nd column, descending":=GROUPBY(B2:B25, F2:F25, SUM, 0, 1, -2)I10=GROUPBY(B2:B25,F2:F25,SUM,0,1,-2)
Shows I10: East, J10: $5,321, I11: North, J11: $4,520, I12: West, J12: $4,367, and 4 more
In
I18, show each region’s share of all sales: usePERCENTOFas the function,=GROUPBY(B2:B25, F2:F25, PERCENTOF). The cells are already formatted as percentages.I18=GROUPBY(B2:B25,F2:F25,PERCENTOF)
Shows I18: East, J18: 29.8%, I19: North, J19: 25.3%, I20: South, J20: 20.3%, and 4 more
Finally, a cross-tab in
L2: regions down the side and products across the top,=PIVOTBY(B2:B25, C2:C25, F2:F25, SUM)L2=PIVOTBY(B2:B25,C2:C25,F2:F25,SUM)
Shows L2: (empty), M2: Chair, N2: Desk, O2: Lamp, P2: Shelf, Q2: Total, and 30 more