Post image for Pivot Tables Explained Excel 2007

Pivot Tables Explained Excel 2007

by on November 1, 2010

in Excel,Microsoft Office Training,Online Training

Pivot Tables in Excel are one of the most powerful tools, and once you understand how they work, they’re actually quite easy to insert and modify.  In this example we’re going to work with a small amount of data for illustration purposes, but Pivot Tables are in their element with huge amounts of data laid out in a columnar format.

Forget Filters and Subtotal, Pivot Tables can do both of these and more in a few seconds.

Note: if you’d prefer to watch a video tutorial on Pivot Tables that will teach you how to create Pivot Tables, choose fields, Pivot Table Design, filtering Pivot Tables, Modify Pivot Table data, and insert Pivot Charts sign up for our Microsoft Office Online Training

OK, looks like you’re happy to read the tutorial…..take the data below for example.

Excel Pivot Table raw data

Let’s say we wanted to SUM the number of viewers by program, going down the rows, then by Region going across the columns and only show Q1 (you can’t see it here but there is data in this table for Q1 through to Q4).  The easiest solution is to insert a Pivot Table like this:

Excel Basic Pivot Table

Note: In the above example we summed the viewers, but instead of, or in addition to SUM, we can COUNT, AVERAGE, PRODUCT and more.

We can also change the formatting and customise the default ‘Row Labels’, ‘Column Labels’ and ‘Sum of Viewer’ headings to make the report more polished.  We’ll get to that soon.

How to Insert a Pivot Table in Excel 2007

Download the workbook and practice as you go.

1)      Click anywhere in your data

2)      On the ‘Insert’ tab click the ‘PivotTable’ button and select ‘PivotTable’.

Insert Pivot Table button

3)      The Create PivotTable dialog box will open.

Create Pivot Table dialog box

a.       Excel will automatically select the range of data, but you can change this here if you need to by modifying the range in the Table/Range field.  You can even choose an external source but for most people using your own data will be all you want, so we’re not going to cover that here.

b.      Tell Excel if you want your Pivot Table in a New Worksheet or in the Existing Worksheet.  If you choose Existing Worksheet you will need to tell Excel the top left cell that you would like your Pivot Table to begin in.  If you choose New Worksheet Excel will insert a new worksheet in your file and insert your Pivot Table there.

4)      I’ve chosen to insert my Pivot Table in cell F2 on the sheet where my data is for this tutorial.  Below is how your worksheet will look after step 3. In the right hand section of your screen the Pivot Table Field List window will open and a place holder will be entered beginning in the cell you’ve chosen to insert your Pivot Table, in my case F2:H19.

Pivot Table under construction

5)      The first thing you need to do is choose the fields you want included in your Pivot Table Report. We do this in the Pivot Table Field List window.

PivotTable Field List Window

a.       By ticking the Fields from the list you can tell Excel which fields you want in your Pivot Table report.

b.      By default it will add any labels to the ‘Row Labels’ area, and any columns it detects as values will go into the ‘Values‘ area.  To move them, simply drag and drop the fields to the area you want.

c.       If you’re inserting your Pivot Table on the existing sheet you will see it take shape as you make your selections in the PivotTable Field List.

6)      To insert the Pivot Table shown in the above example, and below, my PivotTable Field List looks like this:

Excel Basic Pivot Table

You can see I’ve set the Period Q1 (cell G1) as a ‘Report Filter’, the programs are my Row Labels, the Regions are my column labels and the Sum of Viewers are my Values.

Ok, so now you’ve inserted your Pivot Table, let’s look at how we can customise it.

Pivot Table Styles

In Excel 2007 Pivot Table styles enable you to make your Pivot Table cool with very little effort.

You’ll notice you now have two new tabs in your Ribbon.  Go to the Design tab and here you can choose from a huge range of predefined styles.  You can even save your own in keeping with your corporate image.

Excel Pivot Table Styles

Just look at how much more professional mine looks with a few clicks of the mouse.

Formatted Pivot Table with Pivot Table Styles

I’ve also changed my ‘Row Labels’ and ‘Column Labels’ headings by typing new names directly into the cell.

Preserve PivotTable Formatting

You can also format your Pivot Table Report manually using the Fonts etc. on the Home tab of the Ribbon, plus you can resize columns and rows.

If you do this there are a few preferences you should set so that your formats aren’t lost on refresh.

1)      Right click anywhere on the Pivot Table.  Select  ‘PivotTable Options’.  The following dialog box will open.  Make sure you tick the ‘Preserve cell formatting on update’ preference and ‘Autofit column widths on update’ is NOT ticked.

Excel Pivot Table Options

Change Pivot Table Value Calculation from the default SUM

Remember at the beginning I said in the Values you aren’t limted to just SUM.  You can also COUNT, AVERAGE, PRODUCT and a few more.

By clicking on the down arrows beside the Report Filter, Column Labels, Row Labels or Values areas you can access tools that will allow you to modify the settings.  This is also where you can change whether the Values are SUM of, COUNT of, AVERAGE of and so on.

Excel Pivot Table Value Field Settings

To change the VALUES from the default, select ‘Value Field Settings’ from the list by clicking the down arrow beside, in our case, Sum of Viewers.

The ‘Value Field Settings’ dialog box will open and you can choose a different calculation from the list on the ‘Summarize by’ tab as shown below.

You can also give the field a custom name.

Excel Pivot Table Value Field Settings

Note: you can have more than one value in your Pivot Table.  For example, you might want to SUM and COUNT the values.  Simply drag the field you want from the ‘Choose Fields to add to report’ list in the Pivot Table Field List into the Values area and alter the Value Field Settings as listed above.  (See the next section for instructions on how to add another value with screen shots.)

Insert a predefined calculated field to your Pivot Table

You can enhance your Pivot Table by inserting a calculated field.  Excel has a list of predefined calculations you can select from.  Note: You can also insert a custom calculated field, but we’re not going to cover that here as I think these are better added to your source data and brought into your Pivot Table as a field.  It’s less prone to error with this approach.

To insert a calculated field from the predefined list available:

1)      First you have to add another Value field to your Pivot Table by dragging, in our case, ‘Viewers’ from the ‘Choose fields to add to report’ section down to the ‘Values’ area. You’ll notice that Excel will put a Values field in the ‘Column Labels’ area as well as the Values areas.  This is because it’s performing the calculation for each column of data.  You can change it to calculate for each row by dragging it to the ‘Row Labels’ area.

2)      Open the ‘Value Field Settings’ dialog box (click the down arrow and select it from the list) and select the ‘Show values as’ tab.

3)      From the drop down list you can choose the type of calculation you want.

4)      Give your calculation a custom name before clicking OK.

Excel Pivot Table Show Values As

In my example below I inserted a ‘% of total’ field and gave it the custom name ‘% of Viewers’.

Excel Pivot Table example of inserted field

Filter Pivot Table Data

What say we wanted to only show data for a few of our programs?  We can filter our row labels by clicking on the down arrow beside ‘Row Labels’ in our Pivot Table.  And just like regular filters we can instruct Excel to only display the values we choose.

Filter Pivot Table

Note: in this filter we can also sort our PivotTable row labels.

Filtered Pivot Table example

Filters can also be applied to column labels.

Changing the Orientation of your Pivot Table

You can have more than one field in each area.  For example, what if we wanted to see the data grouped by region down the rows?  Our Pivot Table would look like this:

Change Orientation of Pivot Table

Simply rearrange the fields in the Pivot Table Field List by dragging and dropping the fields to the area you want.

Pivot Table Tools

You will also notice you now have two new tabs in the Ribbon for Pivot Table Tools; Options and Design.

Pivot Table Design and Options tabs

There’s too much to work through all of the features here but free video tutorials are available. Simply sign up for our free Microsoft Office Online Training and watch the video tutorials on Pivot Tables to learn how to create Pivot Tables, choose fields, Pivot Table Design, filtering Pivot Tables, Modify Pivot Table data, and insert Pivot Charts.

Pivot Table Source Data Rules

1)      No blank rows or columns.

2)      Each column must have a heading.  This heading will be carried over to label your Pivot Table rows and columns.

3)      Make sure your source data is formatted correctly.  That is if they’re dates, format them as dates and so on.

4)      If the Pivot Table Field List disappears click anywhere on the Pivot Table and it will reappear.

Download the workbook and practice what you’ve learnt.

Did you find this useful, or did it open a can of worms? Let us know by leaving a comment.

Share the knowledge with your friends and colleagues on Twitter, Facebook etc. using the shortcuts below.

Want more? Sign up for our newsletter below and receive weekly tips & tricks to your inbox, plus you’ll get our 100 Excel Tips & Tricks e-book.

FREE PDF Download
100 Excel Tips & Tricks

Excel Tips & Tricks E-Book
Just enter your details below

Leave a Comment

{ 18 comments… read them below or add one }

Natalie November 5, 2010 at 10:52 am

great diagrams, makes it v clear. thanks

Reply

Jolene November 10, 2010 at 12:12 pm

oww. my head hurts. I knew about pivot tables but have never really used them, but will read through this again and do some test scenarios.

thanks

J

Reply

Niki March 18, 2011 at 10:32 pm

is it possible to delete certain cells from a column of a pivot table and insert your own formula?

Reply

Mynda March 30, 2011 at 12:39 pm

The short answer is no. You can however add a custom calculation column with your own formula, or you can add a column to your source data that contains the custom calculation you want to include. There’s more on this in the Excel premium training tips & tricks.

Reply

Karen Stacey August 16, 2011 at 11:44 pm

can pivot tables count the times names/words appear in cells of rows or columns rather than count or sum numbers

Reply

Mynda Treacy August 17, 2011 at 9:11 am

Hi Karen,

Thanks for your question.

PivotTables can count the instances of the same text string. A text string can contain one word or many. However they can’t single out a word from a text string and count it.

For example:

Cell A1: The quick brown fox jumped over the log
Cell A2: The quick brown fox jumped over the log
Cell A3: The quick brown fox jumped over the big log

A PivotTable would count 2 instances of “The quick brown fox jumped over the log” and one instance of “The quick brown fox jumped over the big log” but it couldn’t count how many times the word “brown” appeared.

Formula solution:

To count the instances of “brown” you could use the following array formula (where cell B2 contains the word “brown”):

=COUNT(IF(FIND(B2,A1:A3)),1,”"))

Remember: because it’s an array formula you need to enter it with CTRL+SHIFT+ENTER for Excel to calculate the result correctly.

Kind regards,

Mynda.

Reply

Sadiq Ali August 21, 2011 at 8:35 pm

I found the website very productive and supportive. I can’t stay without appreciating the site.

Reply

Lori October 7, 2011 at 4:38 am

Helpful tutorial – thanks

Reply

Mynda Treacy October 7, 2011 at 2:13 pm

Thanks Lori :) Glad you liked it.

Kind regards,

Mynda.

Reply

mike October 10, 2011 at 4:09 am

thnnx

Reply

lc October 27, 2011 at 10:21 pm

Pivot table sorts the row labels in alphabetical order. How can I customise this eg. show
wiggles
bat man
night garden etc
Thanks

Reply

Mynda Treacy October 28, 2011 at 10:23 am

Hi lc,

You can manually customise the order of your row labels:

1. select the cell containing the row label you want to move
2. move your mouse to the bottom edge of the cell until your mouse pointer changes to a 4 sided arrow.
3. left click your mouse and drag your row label to the new position.

Now when you refresh your PivotTable it will keep your order.

Kind regards,

Mynda.

Reply

manoj kumar dabgotra February 19, 2012 at 2:14 pm

thanx, its realy help us too co op up in the copreate world

Reply

Sara V April 1, 2012 at 11:54 pm

1. I am collapsing rows but this feature automatically collapses rows that contain the same information. Can this feature be turned off.

2. For some reason when I save my pivot table and reopen all my filters change to all and information is lost.

Reply

Philip Treacy April 4, 2012 at 6:57 am

Hi Sara,

I’d say there are some settings in your PivotTable Options that are the reason for these issues. To edit your PivotTable Options right click anywhere on the PivotTable and select PivotTable Options.

Otherwise without seeing your file I can’t tell what the cause is.

I hope that gives you some direction.

Kind regards,

Phil.

Reply

mohammed zainal sarwar April 27, 2012 at 7:50 am

I would really appreciate if i will be able to learn pivot table with the assistance of this site.thanks.

Reply

Peter Beutler April 29, 2012 at 10:33 am

When I try to download the workbook from the lessons, I’m only getting the the XML language, not the actual Excel file.

Can you give me some help. I don’t know how to work in the XML format nor I’m I a programer.

Thank you
Peter

Reply

Mynda Treacy April 30, 2012 at 10:29 pm

Hi Peter,

Your browser is changing the file extension. The file is an Excel workbook so the file extension is .xlsx

Make sure when you choose ‘save file as’ (or similar depending on your browser) that you ensure the file extension is .xlsx and all should be fine. If not let me know via the Contact Us page and I’ll email it to you.

Kind regards,

Mynda.

Reply

Previous post:

Next post: