An Introduction to Excel Pivot Tables
An Introduction to Excel Pivot Tables
Excel Pivot Tables are tables that are produced by Excel, to summarise large amounts of data in a spreadsheet.
This is best explained by way of an example...
Imagine your company kept spreadsheet of every sale that was made during the first quarter of 2013. The
spreadsheet records the sale date, the invoice reference, the invoice total, the salesperson, and the sales region.
This spreadsheet is shown below. (If you wish, copy those 10 rows and paste them in Excel to follow the steps!)
A B C D E
1 Date Invoice Ref Amount Sales Rep. Region
2 01/01/2013 2013-0001 $819 Barnes North
3 01/01/2013 2013-0002 $456 Brown South
4 01/01/2013 2013-0003 $538 Jones South
5 01/01/2013 2013-0004 $1,009 Barnes North
6 02/01/2013 2013-0005 $486 Jones South
7 02/01/2013 2013-0006 $948 Smith North
8 02/01/2013 2013-0007 $740 Barnes North
9 03/01/2013 2013-0008 $543 Smith North
10 03/01/2013 2013-0009 $820 Brown South
. . . . .
. . . . .
11 . . . . .
An Excel pivot table can summarise the data in the spreadsheet above, to show the number or sums of any of
the columns of data. For example, the smaller summary pivot table shows the total sum of all sales, for each of
the four sales people, for the first quarter of 2013.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 1
A more complex pivot table is shown below. In this pivot table, the sales totals are broken down by month for
each sales person. The sales totals for each area are also shown.
A further feature of pivot tables is the ability to quickly show the data that makes up any part of the table. For example,
if you wanted to see a list of Brown's sales during January 2013, you would simply double click on the cell showing this
value (the value $23,918 in the above example spreadsheet).
Excel then creates the new worksheet (shown on the right), listing just Brown's sales during January 2013. For the
time being, don't worry about how the above pivot tables are produced. This section of the tutorial simply aims to
answer the question "What is a Pivot Table in Excel?". We will learn how to create the tables in the next few sections
of this tutorial.
We will start with a basic pivot table, using an example spreadsheet of company sales figures obtained during the first
quarter of 2013. This spreadsheet, which was introduced in Part 1 of this tutorial, is repeated below:
A B C D E
1 Date Invoice Ref Amount Sales Rep. Region
2 01/01/2013 2013-0001 $819 Barnes North
3 01/01/2013 2013-0002 $456 Brown South
4 01/01/2013 2013-0003 $538 Jones South
5 01/01/2013 2013-0004 $1,009 Barnes North
6 02/01/2013 2013-0005 $486 Jones South
7 02/01/2013 2013-0006 $948 Smith North
8 02/01/2013 2013-0007 $740 Barnes North
. . . . .
. . . . .
9 . . . . .
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 2
We will first create a very simple pivot table, which shows the total sales for each of the four sales reps in the above
spreadsheet.
1. Select any cell within the data range or select the entire data range to be used in your Pivot Table.
Note: If you select a single cell in the data range, Excel will automatically identify, and select the whole data
range for your Pivot Table. In order for Excel to successfully do this, the following must be satisfied:
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 3
4. You will now be presented with an empty Pivot
Table, and a 'Pivot Table Field List', which
contains several data fields. Note that these are
the headers from your initial data spreadsheet.
In this example, the values in the 'Amount' column are all numeric and so the 'Σ Values' section will default to
calculating the "Sum of Amount".
However, if you have non-numeric or blank values in the 'Amount' column of your original data sheet, your pivot table
may default to displaying the "Count of Amount" instead of the "Sum of Amount". If this happens, you can change
this to sum the values as follows:
Within the 'Σ Values' box, click on the text "Count of Amount" and select the option Value Field Settings....
Within the 'Summarise Values By' tab, select the option Sum.
Click OK.
5. Your Pivot Table will be populated with the total sales for each sales Pivot Table Before Formatting:
rep, as shown on the right.
Right click on this column with the mouse and select the
option Format Cells ...
A window will pop up. Ensure the Number tab of this window
is selected
From the list of data types, select Currency, and then, from Pivot Table After Currency
the options that appear on the right, select the currency type Formatting:
and the number of decimal places that you want to display.
Click OK
Your final Pivot Table will be as shown on the right.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 4
It is often useful to group a pivot table by the row or column values. Excel can do this automatically for numeric values
(including dates & times). This is shown in the following examples.
If you want to group the sales figures by month, you can this as follows:
Right click on left column of the pivot table (containing the dates) and
select the option Group...
You will be presented with an options box (shown on the right).
Select the value Months and click OK.
This will group the figures by month, as shown in the pivot table below.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 5
Example 2: Group a Pivot Table by Range
Imagine you have created the pivot table on the left, which groups 150 children
according to age. The ages range from 5 to 16 years.
If you want to group the ages into the age ranges 5 - 8 years, 9 - 12 years and 13-
16 years, you can this as follows:
Right click on left column of the pivot table (containing the ages) and select
the option Group...
You will be presented with the options box shown on the right.
Excel has defaulted to the minimum and maximum values of 5 and 16, as
these are the minimum and maximum ages within the data.
We want to group the ages into 4-year periods, so we change the value in the
lower box (labelled By:) to a 4.
Click OK.
This will group the ages into categories, beginning with age 5 - 8 and increasing by by 4 years each time. The
resulting pivot table is shown below:
Right click on left column of the pivot table (containing the grouped values)
Select the option Ungroup...
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 6
Common Pivot Table Grouping Error
Pivot Table Grouping Error: Cannot Group That Selection
If you attempt to group a pivot table, but find that the Group... option is greyed out, or that a window pops up,
saying "Cannot Group That Selection", this is usually because the data column in the original data sheet contains
one or more non-numeric values (or non-date values).
In order to fix this, you will need to return to your original data sheet and amend the non-numeric values (or
delete the rows containing the non-numeric values).
Once you have done this, right click on the pivot table and select Refresh. This will update the values in the pivot
table, and you should now be able to group the selected row or column values.
For the example pivot table, we will use an example spreadsheet of company sales figures obtained during the
first quarter of 2013. This spreadsheet, which was introduced in Part 1 of this tutorial, is repeated below:
A B C D E
1 Date Invoice Ref Amount Sales Rep. Region
2 01/01/2013 2013-0001 $819 Barnes North
3 01/01/2013 2013-0002 $456 Brown South
4 01/01/2013 2013-0003 $538 Jones South
5 01/01/2013 2013-0004 $1,009 Barnes North
6 02/01/2013 2013-0005 $486 Jones South
7 02/01/2013 2013-0006 $948 Smith North
8 02/01/2013 2013-0007 $740 Barnes North
9 03/01/2013 2013-0008 $543 Smith North
10 03/01/2013 2013-0009 $820 Brown South
. . . . .
. . . . .
11 . . . . .
For this advanced pivot table example we will create a pivot table that shows the total sales for each month of the
year, broken down by sales region and sales rep. The process for creating this Pivot Table is described below.
1. Select any cell within the data range or select the entire data range to be used in your Pivot Table.
Note: If you select a single cell in the data range, Excel will automatically identify, and select the whole data
range for your Pivot Table. In order for Excel to successfully do this, the following must be satisfied:
- Each column in the data range has a unique header
and
- The data does not contain any blank rows
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 7
2. Click on the Pivot Table button, which is
generally (in Excel versions 2010 or 2007)
located on the left, within the 'Insert' tab.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 8
5 The resulting Pivot Table (shown on the
. right) will be populated with the daily sales
totals for each sales region and each sales
rep.
However, we want to group the dates by
month. To do this:
Right click on any of the dates in the
left hand column of the Pivot Table
As required, the final pivot table shows the total monthly sales, broken down by sales region and sales rep.
The Pivot Table might be improved visually, by formatting. For example, if columns B - G are formatted as
currencies, this will make the Pivot Table easier to read.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 9
Pivot Table Report Filter
You can also quickly view just the sales for the
South region by selecting 'South' from the drop
down menu.
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 10
These options are found:
In Excel 2007-2013: In the 'Home' tab, under the 'Sort & Filter' option or
By right-clicking on the Pivot Table column and selecting the 'Sort' option
http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 11