Microsoft Excel 2013™ Pivot Tables (Level 3) : IT Training
Microsoft Excel 2013™ Pivot Tables (Level 3) : IT Training
Contents
Introduction .............................................................................................................. 1
Creating a Pivot Table ............................................................................................ 1
A One-Dimensional Table .................................................................... 2
A Two-Dimensional Table .................................................................... 4
A Three-Dimensional Table ................................................................. 5
Hiding and Showing Summary Values ............................................................ 5
Adding New Data and Altering Table Layout ................................................ 6
Changing the Summary Statistics and Data Format................................... 7
Removing a Summary Statistic........................................................................... 8
Multiple Row/Column/Filter Fields ................................................................... 8
Grouping and Details .......................................................................................... 10
Row/Column Field Options and Built-in Styles ......................................... 12
Updating a Pivot Table........................................................................................ 13
Pivot Table Options ............................................................................................. 13
Pivot Charts ............................................................................................................. 14
Introduction
A Pivot Table is the name Excel gives to what is more commonly known as a cross-tabulation
table. Such tables can be one, two or three-dimensional and offer a range of summary statistics.
They can be modified interactively and can be based on data from more than one worksheet.
You now have to select which data series you are summarizing by dragging the field buttons from the
PivotTable Fields pane on the right and dropping them into the areas below the field list. Text fields are usually
used to specify the structure of a Pivot Table, with numeric fields supplying the data.
A One-Dimensional Table
One-dimensional pivot tables are very useful for obtaining subtotals. Here, for example, you might want to
know the total expenditure by each employee:
1. Drag and drop the [Employee] field list button down into the area marked Rows
2. Drag and drop the [Amount] field list button into the area under ∑ Values
The Pivot Table is now automatically filled in with the data. The end result should look like this:
2
As you used a numeric field for the summary data, the values are summed. Had you used a text field, the
number of observations would have been counted. There are various other measures as you will see later.
Note that in Excel 2013, there is a [Recommended PivotTables] button on the INSERT tab, and this could
have been used to produce the same pivot table as above (Sum of Amount by Employee) in a new worksheet.
To get the Pivot Table to show Employee rather than Row Labels, carry out the following sequence of
instructions:
3. Click on the [Options] button (on the far left of the PIVOTTABLE TOOLS ANALYZE tab) or right click in
the table and choose PivotTable Options…:
4. In the PivotTable Options window that appears, click on the Display tab
5. Click in the box next to Classic PivotTable layout to turn this option on and click [OK]
Employee has now appeared at the top, but the layout of the Pivot Table looks different. To return it to the
original layout, but with Employee still at the top (instead of Row Labels):
6. Repeat steps 3-5, with the last step turning off the Classic PivotTable layout option
Now your Pivot Table should show as follows:
3
To sort the names into a different alphabetical order and show the figures as money:
7. Click on G5 then on the HOME tab followed by the [Sort & Filter] button in the Editing group and
finally the 2nd option of Sort Z to A - the names are sorted in reverse alphabetical order
8. Next, select the current totals in the pivot table by dragging through them (cells H5 to H12)
9. Click on the HOME tab and the [Accounting] button in the Number group (the one with the gold
coins) – there should be £ symbols to the left of each number
A Two-Dimensional Table
By using a second dimension (i.e. a column field as well as a row field), you can get a more detailed
breakdown of the figures. Here, for example, you might want to know the expenditure by each employee for
each category. This second field needs to be added to the pivot table layout. Until you are more familiar with
how pivot tables work, it's best to re-display the skeleton first:
1. Click on the PIVOTTABLE TOOLS ANALYZE tab and then [Clear] button in the Actions group followed
by Clear All to start all over again
2. Drag and drop the [Employee] field button down into the area marked Rows
3. Drag and drop the [Category] field button down into the area marked Columns
4. Drag and drop the [Amount] field button into the area under ∑ Values
The Pivot Table now shows the breakdown of each employee's expenditure for the three categories, i.e. Food,
Stationery and Travel, as follows:
4
A Three-Dimensional Table
You can add a third dimension to a pivot table by having a drop-down list from which you select the third
variable. The remaining data series on this worksheet refers to dates, but as they stand they are of little use in
summarizing the data (nearly every date is a different value). To get a breakdown for each month, you first
have to create a new field isolating this from the date:
1. In cell E1 type the heading Month and press <Enter>
2. In cell E2 type the formula =text(a2,"mmm") and press <Ctrl Enter> - if you didn't already know
it, holding down <Ctrl> as you press <Enter> keeps the active cell where it is
This should isolate the month from the date, in this case, Jan. If you want to learn more about the Text
function, work through the notes entitled Microsoft Excel 2013: Dates and Times.
3. Double click on the small green square in the bottom right-hand corner of the E2 cell to fill down the
column with the months
4. Click on a cell in the pivot table to reactivate the PivotTable Fields pane and the PIVOTTABLE TOOLS
ANALYZE and DESIGN tabs
5. On the PIVOTTABLE TOOLS ANALYZE tab, click on the icon above the [Change Data Source] button in
the Data group
6. Redefine the data source table/range to include column E (i.e. change $D$61 to $E$61) – click on [OK]
7. Drag and drop the new [Month] field button into the area under Filters in the PivotTable Fields pane
To look at the accounts for any one month:
8. Click on the list arrow in cell H2, select the month required (e.g. Jan) then click on [OK]
Your Pivot Table should look as follows (if you chose Jan as your month):
3. Drag the ∑ Values field button above the Employee field button in the Rows area under PivotTable
Fields
The data is now summarized first by the Values fields and then by Employee.
6
Changing the Summary Statistics and Data Format
To change the summary statistics:
1. Click on the Sum of Amount field button in the ∑ Values area under PivotTable Fields and choose Value
Field Settings... from the menu - a dialog box appears:
2. Under Summarize value field by choose Average (note what else is available)
3. Press <Enter> or click on [OK] to confirm this
Note that you can add the same data series into the Data area more than once if you need to - for example to
show both the maximum and minimum values.
Another method of changing the field settings is to right click on the data in the Pivot Table:
4. Right click on Average of Amount in the Pivot Table and choose Value Field Settings…
5. Change Summarize value field by back to Sum then press <Enter> or click on [OK]
You can also change the data format in the Value Field Settings dialog box:
6. Click on the Count of Employee field button in the ∑ Values area under PivotTable Fields and choose
Value Field Settings…
7. Click on the [Number Format] button in the bottom left – the Format Cells window appears
8. Change the Category: to Number and set Decimal places: to 0
9. Press <Enter> or click on [OK] to confirm this, then again to close the Value Field Settings dialog box
Your Count of Employee data should now just be numbers without £ symbols in front as shown below:
An easier way to change the format is to right click on Count of Employee in the Pivot Table and choose
Number Format….
7
Removing a Summary Statistic
To remove a summary statistic from the Pivot Table, in this case, the Count of Employee:
1. Note the area labelled Values in the bottom right corner of the PivotTable Fields pane
2. Click on Count of Employee and choose Remove Field
Only the Sum of Amount is now shown.
A better arrangement is obtained by moving the Month box into the Rows area of the PivotTable Fields pane:
2. Drag the Month field button from the Columns area to the Rows area, and put it under the Employee
field button
8
To hide each employee's total:
3. Click on the Employee field button and choose Field Settings...
The following Field Settings dialog box should appear:
9
Grouping and Details
Earlier in these notes (in the three-dimensional table section), you calculated a Month field, to view the
monthly expenditure statistics. In fact, there was no need to calculate a new field as you can group data in
Pivot Tables.
The grouping available depends on the type of data held in the field. Numbers can be grouped in equally-
sized ranges (e.g. values 0-10, 10-20, 20-30 etc.) while dates/times can be summarized by years, quarters,
months, days, hours etc. Grouping cannot be carried out on text values.
To view monthly expenditure without calculating a new field:
1. Click on the Month field button in the Rows area and choose Remove Field
2. Drag the Date field button from the top of the PivotTable Fields pane to below the Employee field
button in the Rows area at the bottom - expenditure is shown for each date
3. Next, right click on any date value in column H and choose Group (or click on any date and then click
on the [Group Selection] button in the Group area of the PIVOTTABLE TOOLS ANALYZE tab) - a dialog
box appears (the one on the right shows the Grouping window for numeric data):
10
11. Right click on Apr in H9 and choose Expand/Collapse followed by Expand - the Show Detail dialog box
appears
12. From the available fields choose Amount then press <Enter> for on [OK]
Your Pivot Table data and fields should now look something like:
13. To hide the detail you can repeat step 11, but choose Expand/Collapse followed by Collapse, or click
on the [-] button to the left of Apr
14. End by removing the Detail column for the Amount by clicking on the Amount field button in the
PivotTable Fields pane and selecting Remove Field
Tip: Pivot Tables have another very useful feature. If you double click on any of the calculated cells in a table
(often a total), a copy of that data is pasted onto a new sheet. For example, to see all of the Food expenses,
double click on cell I33; to see Steve's claims for January, double click on cell L29.
11
Row/Column Field Options and Built-in Styles
Slightly different settings apply to fields being used as row/column headings from those being used in the
data area. You have already had a brief look at the latter; now look at a row field setting:
1. Click on the Employee field button under the Rows area in the PivotTable Fields pane and choose
Field Settings...
2. Under Subtotals, you can decide whether you want the same statistic as in the data area (i.e. Sum) or
whether you want to set a different one – click on Custom then choose Average
3. Click on [Layout & Print] and investigate the options - turn on Show item labels in outline form
(make sure Display subtotals at the top of each group is turned off)
4. Press <Enter> or click on [OK] and the table is updated to reflect the changes made - note the
monthly averages now show (instead of totals)
Your Pivot Table data and fields should now look something like:
Pivot Tables are used a lot in the commercial world and built into Excel are various pre-defined layouts which
make use of the field setting and table layout options. To see these:
5. Click on the PIVOTTABLE TOOLS DESIGN tab on the Ribbon
6. Move the mouse over the various PivotTable Styles provided – the pivot table shows a preview of the
new style
7. To see more styles, click on the [More] button below the scroll bar attached to the styles
It's unlikely you will be making use of these styles but it's worth knowing of their existence. You can even
design your own style via the New PivotTable Style… option below the pre-defined styles. The buttons in the
PivotTable Style Options group on the Ribbon can also be used to customise the settings. Here:
8. If you have applied a style, [Undo] it (or press <Ctrl z>) to remove any formatting
9. End this section by moving the Date field button from the Rows area back into the Filters area in the
PivotTable Fields pane
12
Updating a Pivot Table
Although pivot tables appear to interact closely with the raw data, they are in fact based on a copy of the data
values, held in temporary memory. If you change a data value, the pivot table will not reflect this – not even if
you make fundamental changes to the layout or summary statistics. You have to explicitly refresh the data for
the new values to be included in the summaries:
1. Change Chris' travel in cell D4 from £100 to £3.75 – note that cell J6 isn't updated
2. Click on cell J6 then on the PIVOTTABLE TOOLS ANALYZE tab followed by the [Field Settings] button
in the Active Field group. In the Value Field Settings window, change Summarize Values By to Max (press
<Enter> or click on [OK] ) - again, J6 doesn't change
3. Drag the Amount field button from the top of the PivotTable Fields pane into the Values area and
under the Max of Amount field button at the bottom - Chris' travel appears twice as £100!
4. Click on the [Refresh] button on the PIVOTTABLE TOOLS ANALYZE tab (or right click on the data and
choose Refresh) – the new figure now shows
5. End by removing Max of Amount - click on Max of Amount in Values in the bottom right of the
PivotTable Fields pane and choose Remove Field
13
Pivot Charts
When you first inserted the PivotTable at the very start of this training, you could have chosen to have a pivot
chart. As an introduction to pivot tables that would have been very confusing. However, you can at any time
plot a chart if you want one:
1. Click on the [PivotChart] button in the Tools group on the PIVOTTABLE TOOLS ANALYZE tab – press
<Enter> for [OK] to accept the default (Column) chart
A column chart appears on the same sheet and three new PIVOTCHART TOOLS tabs (ANALYZE, DESIGN and
FORMAT) are added to the Ribbon. To move the chart onto a separate sheet:
2. Click on the PIVOTCHART TOOLS DESIGN tab followed by the last [Move Chart] button, and then
select the New Sheet radio button and click on [OK]
Your Pivot Chart and fields should look something like:
3. In the top left-hand corner of the Pivot Chart, click on the list/filter arrow to the right of Date and
choose a particular month, e.g. Jan, and click [OK]
Tip: If you return to look at the data in the Pivot Table on the Accounts sheet, you will see that it is showing
the same information as on the Pivot Chart, but in numbers. Remember to click back on the Chart1 sheet to
return to the Pivot Chart.
4. Repeat step 3, but turn on Select Multiple Items and choose a second month, e.g. Mar
5. Repeat step 3, but choose (All) to reshow all the data
6. Click on the list/filter arrows attached to Employee (bottom left by the axes) and Category (middle
right of chart above the legend) to set the Employee(s) and Category(ies) respectively
7. Repeat step 6, but choose (Select All) to reshow all the data
8. Using the PivotChart Fields pane on the right of the chart, drag the Month field button below the
Employee field button in the AXIS (CATEGORIES) area – you now have a chart showing each employee’s
monthly spending
9. Drag the Month field button above the Employee field button in the AXIS (CATEGORIES) area to show a
summary by month then employee
14
10. Drag the Month field button into the Values area to get the Count of Month (i.e. how many claims
per month) figures (note that these may still be in a currency rather than number format)
11. Click on Count of Month and choose Remove Field to get rid of the extra columns
The last two PivotChart Tools tabs are in fact the regular tabs you get with any chart. You can use these to
customise your chart (change chart type or colour etc.). The ANALYZE tab is unique to Pivot Charts and
Tables. To see it in action:
12. Click on the PIVOTCHART TOOLS ANALYZE tab
13. Select one of the series (e.g. Travel) by clicking on any of its columns – little circles, known as handles,
appear on the columns
14. Click on the [Expand Field] button in in the Active Field group, choose one of the options, e.g.
Category, and click on [OK]
15. End by closing the file - there's no need to save the changes, unless you want to
15