Chapter 11. Using Pivot Charts

In This Chapter

  • An introduction to pivot tables

  • How to create a pivot table

  • How to create a pivot chart

  • Differences between pivot charts and standard charts

  • Pivot chart examples

Many people (author included) consider pivot tables to be the most innovative and powerful analytical feature in Excel. A pivot table can instantly convert a mass of data into a nicely summarized table. Pivot tables have been around since Excel 5. Beginning with Excel 2000, this feature was augmented to include charting capabilities. And, in Excel 2007, pivot charts are better than ever.

This chapter starts out with an introductory overview of pivot tables (for the uninitiated) and then moves on to cover pivot charts. If you're already familiar with pivot tables, you can skip the introductory material and jump straight to the section "Working with Pivot Charts," later in this chapter.

What Is a Pivot Table?

A pivot table is essentially a dynamic summary report generated from a database. The database can reside in a worksheet (in the form of a table) or in an external data file. A pivot table can help transform endless rows and columns of numbers into a meaningful presentation of the data.

For example, a pivot table can create frequency distributions and cross–tabulations of several different data dimensions. In addition, you can display subtotals and any level of detail that you want. Perhaps the most innovative aspect of a pivot table is its interactivity. After you create a pivot table, you can rearrange the information in almost any way imaginable and even insert special formulas that perform new calculations. You can even create post hoc groupings of summary items (for example, combine Northern Region totals with Western Region totals). And the icing on the cake: With a few mouse clicks, you can apply formatting to a pivot table to convert it into an attractive report.

One minor drawback to using a pivot table is that, unlike a formula–based summary report, a pivot table does not update automatically when you change information in the source data. This drawback doesn't pose a serious problem, however, because a single click of the Refresh button forces a pivot table to update itself with the latest data.

A Pivot Table Example

The best way to understand the concept of a pivot table is to see one. Start with Figure 11-1, which shows a portion of the data used in creating the pivot table in this chapter.

This table is used to create a pivot table.

Figure 11-1. This table is used to create a pivot table.

This table consists of a month's worth of new account information for a three–branch bank. The table contains 712 rows, and each row represents a new account. The table has the following columns:

  • The date the account was opened

  • The opening amount

  • The account type (CD, checking, savings, or IRA)

  • Who opened the account (a teller or a new–account representative)

  • The branch at which it was opened (Central, Westside, or North County)

  • The type of customer (an existing customer or a new customer)

Note

This workbook, named bank accounts.xlsx, is available on the companion CD–ROM.

The bank accounts table contains quite a bit of information. But in its current form, the data doesn't reveal much. To make the data more useful, you need to summarize it. Summarizing a table is essentially the process of answering questions about the data. Following are a few questions that may be of interest to the bank's management:

  • What is the daily total new deposit amount for each branch?

  • How many accounts were opened at each branch, broken down by account type?

  • What's the dollar distribution of the different account types?

  • What types of accounts do tellers open most often?

  • How does the Central branch compare to the other two branches?

  • In which branch do tellers open the most checking accounts for new customers?

You can, of course, spend time sorting the data and creating formulas to answer these questions. Often, however, using a pivot table is a much better choice. Creating a pivot table takes only a few seconds, doesn't require a single formula, and produces a nice–looking report (with an optional chart). In addition, pivot tables are much less prone to error than creating formulas.

Note

Later in this chapter, I present pivot tables and pivot charts that answer the preceding questions.

Figure 11-2 shows a pivot table created from the bank data. This pivot table shows the amount of new deposits, broken down by branch and account type. This particular summary is just one of dozens of summaries that you can produce from this data.

A simple pivot table.

Figure 11-2. A simple pivot table.

Figure 11-3 shows another pivot table generated from the bank data. This pivot table uses a drop–down Report Filter for the Customer item (in row 1). In the figure, the pivot table displays the data only for Existing customers. (The user can also select New or All from the drop–down control.) Notice the change in the orientation of the table? For this pivot table, branches appear as column labels, and account types appear as row labels. This change, which took about five seconds to make, is another example of the flexibility of a pivot table.

A pivot table that uses a report filter.

Figure 11-3. A pivot table that uses a report filter.

Data Appropriate for a Pivot Table

A pivot table requires your data to be in the form of a rectangular database. You can store the database in either a worksheet range (which can be a table or just a normal range) or an external database file. Although Excel can generate a pivot table from any database, not all databases benefit.

Generally speaking, fields (or columns) in a database table consist of two types:

  • Data: Contains a value or data to be summarized. For the bank account example, the Amount field is a data field.

  • Category: Describes the data. For the bank account data, the Date, AcctType, OpenedBy, Branch, and Customer fields are category fields because they describe the data in the Amount field.

A single database table can have any number of data fields and category fields. When you create a pivot table, you usually want to summarize one or more of the data fields. Conversely, the values in the category fields appear in the pivot table as rows, columns, or filters.

Exceptions exist, however, and you may find Excel's pivot table feature useful even for databases that don't contain actual numerical data fields. For example, it's very easy to create a pivot table that displays the count of various items.

Figure 11-4 shows an example of an Excel range that is not appropriate for a pivot table. This range contains descriptive information about each value, but it's not set up as a table. In fact, this range resembles a pivot table summary.

Figure 11-5 shows the same data in a form that is appropriate for a pivot table. Notice that every data cell in the original range shown in Figure 11-4 is represented by a separate row.

Note

The companion CD–ROM contains a workbook with a VBA macro that can convert a summary table into a 3–column table suitable for a pivot table. The filename is reverse pivot.xlsm.

This range is not appropriate for a pivot table.

Figure 11-4. This range is not appropriate for a pivot table.

The data in Figure 11-4, in a form that's appropriate for a pivot table.

Figure 11-5. The data in Figure 11-4, in a form that's appropriate for a pivot table.

Creating a Pivot Table

In the following sections, I describe the basic steps required to create a pivot table, using the bank account data as a model. Creating a pivot table is an interactive process. It's not at all uncommon to experiment with various pivot table layouts until you find one that you're satisfied with.

Specifying the Data

If your data is in a worksheet range, select any cell in that range and then choose Insert

Specifying the Data
In the Create PivotTable dialog box, you tell Excel where the data is and where you want the pivot table.

Figure 11-6. In the Create PivotTable dialog box, you tell Excel where the data is and where you want the pivot table.

Excel attempts to guess the range, based on the location of the active cell. If you're creating a pivot table from an external data source, you need to select that option and then click the Choose Connection button to specify the data source. If you're working with an external data source, the location of the active cell is not important.

Tip

If you're creating a pivot table from data in a worksheet, it's a good idea to first create a table for the range (by choosing Insert

In the Create PivotTable dialog box, you tell Excel where the data is and where you want the pivot table.

Specifying the Location for the Pivot Table

Use the bottom section of the Create PivotTable dialog box to indicate the location for your pivot table. The default location is in a new worksheet, but you can specify any range in any worksheet, including the worksheet that contains the data. You can specify a single cell that will be the upper left corner of the pivot table.

Click the OK button, and Excel creates an empty pivot table and displays its PivotTable Field List, as shown in Figure 11-7.

Use the PivotTable Field List to build the pivot table.

Figure 11-7. Use the PivotTable Field List to build the pivot table.

Tip

The PivotTable Field List is normally docked on the right side of Excel's window. By dragging its title bar, you can move it anywhere you like. Also, if you click a cell outside the pivot table, the PivotTable Field List is hidden.

Laying Out the Pivot Table

Next, set up the actual layout of the pivot table by using the PivotTable Field List. You can do so by using either of these techniques:

  • Drag the field names to one of the four boxes on the PivotTable Field List.

  • Right–click a field name and choose its location from the shortcut menu.

Note

In previous versions of Excel, you could drag items from the field list directly into the appropriate area of the pivot table. This feature is still available, but it's turned off by default. To enable this feature, choose PivotTable Tools

Laying Out the Pivot Table

The following steps create the pivot table presented earlier in this chapter (see the section "A Pivot Table Example"). For this example, I drag the items from the top of the PivotTable Field List to the areas in the bottom of the PivotTable Field List.

  1. Drag the Amount field into the Values area. At this point, the pivot table displays the total of all the values in the Amount column.

  2. Drag the AcctType field into the Row Labels area. Now the pivot table shows the total amount for each of the account types.

  3. Drag the Branch field into the Column Labels area. The pivot table shows the amount for each account type, cross–tabulated by branch (see Figure 11-8).

After a few simple steps, the pivot table shows a summary of the data.

Figure 11-8. After a few simple steps, the pivot table shows a summary of the data.

Formatting the Pivot Table

Notice that the pivot table uses General number formatting. To change the number format used, select any value and choose PivotTable Tools

Formatting the Pivot Table

You can apply any of several built–in styles to a pivot table. Select any cell in the pivot table and choose PivotTable Tools

Formatting the Pivot Table

You also can use the controls in the PivotTable

Formatting the Pivot Table

The PivotTable Tools

Formatting the Pivot Table

Still more pivot table options are available in the PivotTable Options dialog box, shown in Figure 11-9. To display this dialog box, choose PivotTable Tools

Formatting the Pivot Table
The PivotTable Options dialog box.

Figure 11-9. The PivotTable Options dialog box.

Modifying the Pivot Table

After you've created a pivot table, it's easy to change it. For example, you can add further summary information by using the PivotTable Field List. Figure 11-10 shows the pivot table after I dragged a second field (OpenedBy) to the Row Labels section on the PivotTable Field List. In this example, each account type is broken down by whoever originally opened the account for the client.

Two fields are used for row labels.

Figure 11-10. Two fields are used for row labels.

Following are some tips on other pivot table modifications you can make:

  • To remove a field from the pivot, select it in the bottom Part of the PivotTable Field List and "drag it away."

  • If an area has more than one field, you can change the order in which the fields are listed by dragging the field names. Doing so affects the appearance of the pivot table. You can also change the order of the fields by typing over a field. For example, in cell C4, replace Central by typing Westside and the Westside field swaps positions with the Central field.

  • To temporarily remove a field from the pivot table, deselect the field name in the top Part of the PivotTable Field List. The pivot table is redisplayed without that field. Reselect the field name, and it appears in its previous section.

  • If you add a field to the Report Filter section, the field items appear in a drop–down list, which allows you to filter the displayed data by one or more items. Figure 11-11 shows an example. I dragged the Date field to the Report Filter area. The report is now showing the data only for a single day (which I selected from the drop–down list in cell B1).

The pivot table is filtered by date.

Figure 11-11. The pivot table is filtered by date.

Working with Pivot Charts

The following sections discuss pivot charts and assume that you're familiar with the material already presented in this chapter.

A pivot chart is a graphical representation of a data summary displayed in a pivot table. A pivot chart is always based on a pivot table. Although Excel lets you create a pivot table and a pivot chart at the same time, you can't create a pivot chart without a pivot table.

Note

Pivot charts, by their very nature, are interactive charts. Chapter 7 discusses other ways to create interactive charts.

Creating a Pivot Chart

If you're familiar with creating charts in Excel, you'll have no problem creating and customizing pivot charts. Most of Excel's charting features are available in a pivot chart. By the way, if you've used pivot charts in a previous version of Excel — and were frustrated by their limitations — you'll be pleased to know that pivot charts are improved significantly in Excel 2007.

Excel provides three ways to create a pivot chart:

  • Select any cell in an existing pivot table and choose PivotTable Tools

    Creating a Pivot Chart
  • Choose Insert

    Creating a Pivot Chart
  • Select any cell in an existing pivot table and select a chart type from the Insert

    Creating a Pivot Chart

A pivot chart cannot be a scatter chart, a bubble chart, or a stock chart. If you specify any of these chart types, Excel displays an error message.

Which method you choose is up to you. I usually create the pivot table first and then create a pivot chart from the pivot table. If you create the pivot table and pivot chart at the same time, the chart can get in the way.

Note

A pivot chart is always based on a pivot table. You can't create a pivot chart without an underlying pivot table. Also, a pivot chart always reflects the layout of the pivot table. If you change the layout of a pivot table, the layout of its corresponding pivot chart also changes.

A Pivot Chart Example

Figure 11-12 shows Part of a table that tracks daily sales by region. The Date column contains dates for the entire year (excluding weekends), the Region field contains the region name (Eastern, Southern, or Western), and the Sales field contains the sales amount. The table contains 780 rows. Creating a chart from this table would be very difficult because the data arrangement isn't suitable for a chart.

This data will be used to create a pivot chart.

Figure 11-12. This data will be used to create a pivot chart.

Note

This workbook, named sales by region.xlsx, is available on the companion CD–ROM.

The first step is to create a pivot table to summarize the data. Figure 11-13 shows the pivot table. The Date field is in the Row Labels area, and the daily dates have been grouped into months. The Region field is in the Column Labels area. The Sales field is in the Values area (and it's summarized by summing).

This pivot table summarizes sales by region and by month.

Figure 11-13. This pivot table summarizes sales by region and by month.

Tip

To group dates in a pivot table, right–click a date and choose Group from the shortcut menu. In the Grouping dialog box, indicate the level of grouping. In this example, the dates are grouped by months.

The pivot table is certainly easier to interpret than the raw data, but the trends would be easier to spot on a chart.

To create a pivot chart, select any cell in the pivot table and choose PivotTable Tools

This pivot table summarizes sales by region and by month.

The chart makes it easy to see a strong upward sales trend for the Western division, a slight downward trend for the Southern division, and relatively flat sales for the Eastern division.

The pivot chart uses the data displayed in the pivot table.

Figure 11-14. The pivot chart uses the data displayed in the pivot table.

When you select a pivot chart, the Ribbon displays a new context tab: PivotChart Tools. The commands in the Design, Layout, and Format tabs are virtually identical to those for a standard Excel chart, so you're in familiar territory. The commands in the Analyze tab contain a few commands specific to pivot table charts.

If you modify the underlying pivot table, the chart adjusts automatically to display the new summary data. Figure 11-15 shows the pivot chart after I changed the Date grouping to quarters.

If you modify the pivot table, the pivot chart is also changed.

Figure 11-15. If you modify the pivot table, the pivot chart is also changed.

Pivot Chart Banking Examples

The following sections contain pivot chart examples that use the banking data presented earlier in this chapter. These examples answer the questions posed earlier (see the section "A Pivot Table Example").

Note

The examples in the following sections are available in bank accounts.xlsx, available on the companion CD–ROM.

Question 1

What is the daily total new deposit amount for each branch?

Figure 11-16 shows the pivot table and pivot chart that answers this question.

  • The Branch field is in the Column Labels section.

  • The Date field is in the Row Labels section.

  • The Amount field is in the Values section and is summarized by Sum.

The pivot chart is a stacked area chart.

Note that the pivot table can also be sorted by any column. For example, you can sort the Grand Total column in descending order to find out which day of the month had the largest amount of new funds. To sort, just right–click any cell in the column to sort and choose Sort from the shortcut menu. Note that this change to the pivot table will also change the pivot chart.

This pivot table shows daily totals for each branch.

Figure 11-16. This pivot table shows daily totals for each branch.

Question 2

How many accounts were opened at each branch, broken down by account type?

Figure 11-17 shows a pivot table that answers this question.

  • The AcctType field is in the Column Labels section.

  • The Branch field is in the Row Labels section.

  • The Amount field is in the Values section and is summarized by Count.

The most common summary function used in pivot tables is Sum. In this case, I changed the summary function to Count. To change the summary function to Count, right–click any cell in the Value area and choose Summarize Data By

Question 2
This pivot table uses the Count function to summarize the data.

Figure 11-17. This pivot table uses the Count function to summarize the data.

What if you wanted a second chart (a pie chart) to show the data in the Grand Total column? You can't create a pivot chart from only a portion of the pivot table. To create this pie chart, you need to remove the Branch field from the pivot table and move the AcctType field to the Row Labels section. If you would like to show both charts together, you must create a second pivot table (or make a copy of the original one) and generate the pie chart from the second pivot table. Figure 11-18 shows the pivot table and pivot chart that show the number of accounts by account type.

Question 3

What's the dollar distribution of the different account types?

Figure 11-19 shows a pivot table that answers this question. For example, 253 of the new accounts were for an amount of $5, 000 or less.

This pivot table and pivot chart show the number of new accounts by type, across all branches.

Figure 11-18. This pivot table and pivot chart show the number of new accounts by type, across all branches.

This pivot table counts the number of accounts that fall into each value range.

Figure 11-19. This pivot table counts the number of accounts that fall into each value range.

This pivot table uses only one field: Amount.

  • The Amount field is in the Row Labels section (grouped)

  • The Amount field is also in the Values section and is summarized by Count.

When I initially added the Amount field to the Row Labels section, the pivot table showed a row for each unique dollar amount. I right–clicked one of the row labels and selected Group. Then I used Excel's Grouping dialog box to set up bins of $5, 000 increments.

The second instance of the Amount field (in the Values section) is summarized by Count. I right–clicked a value and chose Summarize Data By

This pivot table counts the number of accounts that fall into each value range.

Notice that the number of accounts for the larger dollar amounts is small. You may prefer to group these larger bins into a single bin of 20, 001 or more. To do so, right–click any cell in the Amount column and choose Group. In the Grouping dialog box, specify 1 for the Start At value, 20, 000 for the Ending At value, and 5, 000 for the By value. Figure 11-20 shows the result. Notice that Excel incorrectly labels the last column as >20001. Technically, it should be >20000.

The pivot table and pivot chart after changing the grouping parameters.

Figure 11-20. The pivot table and pivot chart after changing the grouping parameters.

Question 4

What types of accounts do tellers open most often?

Figure 11-21 shows that the most common account opened by tellers is a checking account.

  • The OpenedBy field is in the Report Filters section.

  • The AcctType field is in the Row Labels section.

  • The Amount field is in the Values section (summarized by Count).

  • A second instance of the Amount field is in the Values section (summarized by Percent of Total).

This pivot table uses a report filter to show only the teller data.

Figure 11-21. This pivot table uses a report filter to show only the teller data.

This pivot table uses the OpenedBy field as a report filter and is showing the data only for tellers. I sorted the pivot table rows so that the largest value is at the top, and I also used conditional formatting to display data bars for the percentages.

Note

Refer to Chapter 9 for more information about conditional formatting.

Using the data bars in the pivot table is an alternative to a pivot chart. However, a pie chart might be a better choice for this information. Note that the pivot chart's title is linked to cell E1, which contains this formula:

="New Accounts By "&B1

Using a linked formula enables you to make the chart's title more descriptive. If I select a different value for the Report Filter field, the chart's title updates accordingly. Without the linked formula, the pivot chart's title would always display Accounts.

Question 5

How does the Central branch compare to the other two branches?

Figure 11-22 shows a pivot table that sheds some light on this rather vague question. It simply shows how the Central branch compares to the other two branches combined.

  • The AcctType field is in the Row Labels section.

  • The Branch field is in the Column Labels section.

  • The Amount field is in the Values section (summarized by Sum).

I grouped the North County and Westside branches together and named the group Other Branches. The pivot table (and pivot chart) shows the amount, by account type.

This pivot table (and pivot chart) compares the Central branch with the other two branches combined.

Figure 11-22. This pivot table (and pivot chart) compares the Central branch with the other two branches combined.

Question 6

In which branch do tellers open the most checking accounts for new customers?

Figure 11-23 shows a pivot table that answers this question. At the Central branch, tellers opened 23 checking accounts for new customers.

  • The Customer field is in the Report Filters section.

  • The OpenedBy field is in the Report Filters section.

  • The AcctType field is in the Report Filters section.

  • The Branch field is in the Row Labels section.

  • The Amount field is in the Values section, summarized by Count.

This pivot table uses three report filters.

Figure 11-23. This pivot table uses three report filters.

This pivot table uses three report filters. The Customer field is filtered to show only New, the OpenedBy field is filtered to show only Teller, and the AcctType field is filtered to show only Checking.

The pivot table depicts the result graphically. Note that I used a linked formula for the chart's title to make the title more descriptive. The title is linked to cell F1, which contains the following formula that gets information from the three report filters:

=B1&" Customer "&B3&" Accounts By "&B2

More Pivot Chart Examples

The following sections present three additional examples of pivot tables and pivot charts.

Creating a Quick Frequency Distribution Chart

The example in this section describes how to use a pivot table to create a frequency distribution chart, sometimes known as a histogram. This technique works with values and text.

Figure 11-24 shows a workbook with ratings from a survey item. Column A consists of the respondent number (from 1 to 192), and column B contains the rating. The objective is to create a frequency distribution chart that shows the number of each rating response. Note that column A is not actually required. A frequency distribution can be created from a single column.

Note

This workbook, named frequency distribution chart.xlsx, is available on the companion CD–ROM.

A pivot chart can display the frequency of each response in column B.

Figure 11-24. A pivot chart can display the frequency of each response in column B.

To create the frequency distribution chart, follow these steps:

  1. Select any cell in columns A or B.

  2. Choose Insert

    A pivot chart can display the frequency of each response in column B.
  3. In the Create PivotTable dialog box, verify that Excel identified the data range correctly, and specify the location for the pivot table and pivot chart. Click the OK button.

    Excel creates an empty pivot table and displays the PivotTable Field List.

  4. On the PivotTable Field List, drag the Rating item to the Row Labels section, and then drag it again to the Values section.

  5. Select any cell in the pivot table, and choose PivotTable Tools

    A pivot chart can display the frequency of each response in column B.
  6. In the Insert Chart dialog box, select a chart type and click the OK button. (A clustered column chart is a good choice.)

Figure 11-25 shows the pivot table and pivot chart. Because the items in the Values section are non–numeric, Excel defaults to the Count summary method — which is exactly what I want.

The pivot chart displays the frequency of each response

Figure 11-25. The pivot chart displays the frequency of each response

Notice that the Rating items are listed in alphabetical order in the pivot table, and on the category axis of the pivot chart. To change the order of the items, you can either

  • Click and drag the left or right border of an item in the pivot table, and drag it to a new position. The pivot chart will adjust accordingly.

  • Just type the name of an item (for example, Good) in the cell where you want it, and let Excel rearrange the items.

If the data consists of numerical values, you might want to create groups (or bins). To do so, right–click the field button in the pivot table and choose Group. Then specify the parameters for the grouping. Figure 11-26 shows a frequency distribution for numeric data, with the results grouped. Note that the pivot table displays a count of the values. By default, the pivot table will display the sum. You'll need to change this by right–clicking a value in the pivot table and choosing Summarize Data By

The pivot chart displays the frequency of each response
This pivot chart displays a frequency distribution for the data in column B, in groups of 10.

Figure 11-26. This pivot chart displays a frequency distribution for the data in column B, in groups of 10.

Selecting Rows to Plot

This section describes how to enable the user to determine which pivot table rows to display in a pivot chart. In other words, it's an interactive chart. Figure 11-27 shows a range of data — results from a customer survey. Each of the 450 customers responded to 14 survey items. Responses are coded as numbers:

  1. Strongly Disagree

  2. Disagree

  3. Undecided

  4. Agree

  5. Strongly Agree

This survey data will be converted to a pivot table.

Figure 11-27. This survey data will be converted to a pivot table.

Note

The example in this section, named survey results.xlsx, is available on the companion CD–ROM.

The goal is to tabulate the survey results and display a chart that depicts the results for one or more of the survey items.

The first step is to create the pivot table. Follow these steps:

  1. Select any cell within the data range and choose Insert

    This survey data will be converted to a pivot table.
  2. Respond to the Create PivotTable dialog box, and create an empty pivot table.

  3. Using the PivotTable Field List, drag the Item field to the Row Labels section.

  4. Drag the Rating field to the Column Labels section.

  5. Drag the Respondent field to the Values section.

  6. In the pivot table, edit the column labels by replacing the values (1-5) with descriptive text.

  7. Format the pivot table values to display as Percent of Row. Right–click any value and choose Summarize Data By

    This survey data will be converted to a pivot table.

Next, create a pivot chart by selecting any cell in the pivot table and choosing PivotTable Tools

This survey data will be converted to a pivot table.

Figure 11-28 shows the pivot table and pivot chart.

This pivot chart displays the results for all survey items.

Figure 11-28. This pivot chart displays the results for all survey items.

The pivot chart is not very usable because it shows too much information. To limit the amount of information in the chart, use either of these methods:

  • Click the drop–down arrow in the Row Labels header in the pivot table and deselect the Select All check box. Then, select one or more items to display. The change is reflected in the pivot chart.

  • Activate the pivot chart, and use the Pivot Chart Filter Pane. Click the drop–down arrow labeled Axis Fields (Category) and deselect the Select All check box. Then, select one or more items to display. The change is reflected in the pivot table.

Using this filtering capability, the user can show the results for any single survey item, and even compare multiple items side by side. Figure 11-29 shows the pivot table and pivot chart after filtering the data to show three survey items.

The pivot chart shows the results for only three items.

Figure 11-29. The pivot chart shows the results for only three items.

Using Data from Multiple Sheets

In some situations, you might have data in multiple worksheets within a workbook. Figure 11-30, for example, shows a workbook that contains three sheets, named Yr2005, Yr2006, and Yr2007. Each sheet contains data for a year, and each has a similar four–column range of cells. This is a simple example. In actual practice, the sheets would probably contain much more data. Also, keep in mind that the data can come from different workbooks.

This workbook contains data in three worksheets.

Figure 11-30. This workbook contains data in three worksheets.

Note

This example, named pivot chart from multiple sheets.xlsx, is available on the companion CD–ROM.

You can create a pivot table to combine the information from these three sheets, although the procedure is certainly not obvious. This section describes how to create a pivot table and pivot chart to summarize the data in these three sheets.

Before Excel 2007, the PivotTable and PivotChart Wizard was used to created pivot tables. The Excel 2007 Ribbon interface has replaced this wizard. Unfortunately, the only way to create a pivot table from multiple data sources is to use this wizard. Here's how to add the missing PivotTable and PivotChart Wizard command to your Quick Access Toolbar (QAT):

  1. Right–click the QAT, and choose Customize Quick Access Toolbar from the shortcut menu. Excel displays the Customize tab of the Excel Options dialog box.

  2. In the drop–down control on the left, choose Commands Not in the Ribbon.

  3. In the list below, select PivotTable and PivotChart Wizard.

  4. Click the Add button to add the command to your QAT.

  5. Click the OK button to close the Excel Options dialog box.

Now that you have access to the missing wizard, follow these steps:

  1. Activate the Yr2005 worksheet.

  2. Start the PivotTable and PivotChart Wizard by clicking its icon in your QAT. Choose the Multiple Consolidation Ranges option as well as the option to create a pivot table and a pivot chart. Click the Next button.

  3. In Step 2 of the wizard, choose the Create a Single Page Field for Me option. Click the Next button.

  4. In Step 2b of the wizard, you specify the ranges. Select range A1:D13 in the first worksheet and click the Add button. Repeat this step for the other sheets. The All Ranges box should display three ranges. Click the Next button.

  5. In Step 3 of the wizard, specify New Worksheet and click the Finish button. In the pivot table, notice that the Report Filter displays generic item names (Item1, Item2, and Item3).

  6. Using the PivotTable Field List, drag the Page1 field to the Row Labels section (above the Row item). Doing so converts the field to a Row field. You can now change the item's names to more meaningful text: 2005, 2006, and 2007.

  7. The Grand Total column is not meaningful, so delete it. Choose PivotTable Tools

    This workbook contains data in three worksheets.

Figure 11-31 shows the pivot table and pivot chart after making these changes.

The pivot table and pivot chart that summarizes data on three worksheets.

Figure 11-31. The pivot table and pivot chart that summarizes data on three worksheets.

Excel creates a clustered column chart, which is not appropriate because the data in the Ratio series is much smaller in magnitude (and not even visible in the chart). To fix this pivot chart, follow these steps:

  1. Use the PivotChart Filter Pane to display only one year. This makes the chart less cluttered and easier to work with.

  2. Access the Format Data Series dialog box for the Ratio series and assign it to the secondary axis.

  3. Select the Ratio series and choose PivotChart Tools

    The pivot table and pivot chart that summarizes data on three worksheets.

Figure 11-32 shows the pivot chart after making these changes.

The pivot chart, after making some modifications.

Figure 11-32. The pivot chart, after making some modifications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset