0% found this document useful (0 votes)
9 views

An Introduction to Excel Pivot Tables

The document provides a comprehensive tutorial on Excel Pivot Tables, explaining their purpose in summarizing large datasets through examples. It details the steps to create basic and advanced Pivot Tables, including grouping data by dates and regions, and using report filters. Additionally, it addresses common errors and formatting options to enhance the presentation of Pivot Tables.

Uploaded by

Alinoxx Auguiste
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

An Introduction to Excel Pivot Tables

The document provides a comprehensive tutorial on Excel Pivot Tables, explaining their purpose in summarizing large datasets through examples. It details the steps to create basic and advanced Pivot Tables, including grouping data by dates and regions, and using report filters. Additionally, it addresses common errors and formatting options to enhance the presentation of Pivot Tables.

Uploaded by

Alinoxx Auguiste
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Excel Pivot Table Tutorial

What is a Pivot Table in Excel?

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:

- Each column in the data range has a unique header


and
- The data does not contain any blank rows

2. Click on the Pivot Table button, which is


generally (in Excel versions 2010 or 2007)
located on the left, within the 'Insert' tab.

3. You will be presented with the window entitled


'Create PivotTable' (shown on the right).

Make sure that the selected range is the range


that you want to use for your Pivot Table.

There is also an option asking where you want


the Pivot Table to be placed. If you are not sure,
select the option 'New worksheet'
Click OK

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.

Within this 'Pivot Table Field List':

 Drag the 'Sales Rep.' field into the area of


the 'Pivot Table Field List' marked 'Row
Labels'.

 Drag the 'Amount' field into the area of


the 'Pivot Table Field List' marked 'Σ
Values'.

 Check: Make sure that the value in the 'Σ


Values' section of the pivot table
reads "Sum of Amount" and not "Count
of Amount"

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.

If you want the sales to be displayed as a currency, this is done by


formatting the cells containing these values. To do this:

 Select the column containing the cells to be formatted.

 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.

Example 1: Group a Pivot Table by Date


Imagine you have created the pivot table on the left, which shows sales
figures for each date of the first quarter of 2013.

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:

Ungrouping a Pivot Table


To ungroup the values in a pivot table, simply:

 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.

3. You will be presented with the window entitled


'Create PivotTable' (shown on the right).
Make sure that the selected range is the range
that you want to use for your Pivot Table.
There is also an option asking where you want
the Pivot Table to be placed. If you are not sure,
select the option 'New worksheet'
Click OK

4. You will now be presented with an empty Pivot


Table, and a 'Pivot Table Field List', which
contains the data fields for your Pivot Table.
Note that these are the headers from your data
spreadsheet.
We want the Pivot Table to show the sums of the
sales figures for each month, broken down by
region and sales rep.
Therefore, from the 'Pivot Table Field List':
 Drag the 'Date' field into the area marked
'Row Labels'
 Drag the 'Amount' field into the area marked
'Σ Values'
 Drag the 'Region' field into the area marked
'Row Labels'
 Drag the 'Sales Rep.' field into the area
marked 'Row Labels'

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

 Select the option Group...


 A window will pop up. Select the
option Months
(note that you can also group dates
and times by other time periods, such
as quarters, days, hours, etc)
 Click OK
The resulting Pivot Table is shown below:

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

The Pivot Table report filter allows you to view the


data for a single value in one of your data fields.
For example, in the pivot table above, you could
view just the data for the North sales region or just
the data for the South sales region. This is
illustrated below.

In order to view just the data for the 'North' sales


region, return to the 'Pivot Table Field List', and
drag the 'Region' field header into the Report
Filter area, as shown on the right.

You will see that the 'Region' field is now located in


the page drop area, at the top left of the Pivot
Table. Use the drop-down list for this field to select
the Region 'North'. The resulting Pivot Table, which
shows just the sales for the North region, is shown
on the right.

You can also quickly view just the sales for the
South region by selecting 'South' from the drop
down menu.

Sort a Pivot Table in Excel


You can sort a Pivot Table in Excel horizontally or vertically.
This allows you to see, at a glance, the rows or columns
containing the greatest or the smallest values.
We will illustrate how to sort the values in a Pivot Table, using
the example pivot table on the right, which shows a company's
monthly sales.
In order to sort a column or row of the Pivot Table, we use the
Excel Sort Ascending and Sort Descending Excel commands
which are represented by the following symbols in the Excel
menu:
sort ascending
sort descending

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

Sort a Pivot Table by a Column


Imagine you want to find out the month of the year in which the
highest sales figures were recorded. By sorting the 'Grand Total'
column of the pivot table, in descending order, the month with
the greatest sales figures is positioned at the top of the table.
To do this, click on any value inside the 'Grand Total' column
and select the 'Sort Descending' option.
The resulting sorted Pivot Table is shown on the right. This
enables you to easily see that the month with the highest sales
was June, followed by October.

Sort a Pivot Table by a Row


Imagine you want to order the yearly sales totals, so that the person with the smallest total yearly sales is listed first.
To do this, click on any value inside the 'Grand Total' row (i.e. cell B17 or C17 of the example spreadsheet), and select
the 'Sort Ascending' option.
The resulting sorted Pivot Table is shown on the right. As required, the individuals have been ordered, so that the
lowest total sales ($576,817) appears first.
Note that you could also sort the table alphabetically, according to the sales peoples' names. This is done by clicking
on one of the names (either cell B4 or C4) and sorting either in ascending or descending order.

http://www.excelfunctions.net/Excel-Pivot-Table-Tutorial.html 11

You might also like