1. Trang chủ
  2. » Công Nghệ Thông Tin

Printing and Extracting Pivot Table Data

22 468 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Printing and Extracting Pivot Table Data
Trường học Standard University
Chuyên ngành Data Analysis
Thể loại Bài luận
Thành phố City Name
Định dạng
Số trang 22
Dung lượng 307,09 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Another way to extract data is to use the Show Details feature, which returns records from the source data for the selected pivot table cell.. Repeating Pivot Table Headings Problem Your

Trang 1

Printing and Extracting

Pivot Table Data

from different perspectives Sometimes, though, you want a static picture from the pivot table

and need to print the data For the most part, pivot tables print the same as other data on a

worksheet, but you can apply a few special settings to a pivot table Some printing issues, such

as printing a copy of the pivot table for each item in the Report Filter field, can be solved by

programming, and examples are given in Chapter 11

After you create a pivot table, you may want to extract some of the summarized data for

use in other parts of the workbook The GetPivotData worksheet function can be used for

retrieving specific data from the pivot table Another way to extract data is to use the Show

Details feature, which returns records from the source data for the selected pivot table cell

Finally, the Show Report Filter Pages feature can be used to create copies of the pivot table on

newly inserted worksheets

Except where noted, the RegionSales_09.xlsx workbook is used as the sample file for the

problems in this chapter

9.1 Repeating Pivot Table Headings

Problem

Your pivot table spans several printed pages and the report filter, row labels, and column

labels only print on the first page You want the heading rows and labels on every page, so

readers can understand the report In your pivot table, the Product and OrderDate fields are in

the Row Labels area, Region is in the Column Labels area, Category is in the Report Filter area,

and Sum of TotalPrice is in the Values area This problem is based on the RegionSales_09.xlsx

workbook

Solution

You can set options for the pivot table to make the heading rows and labels appear on every

page when you print the pivot table There are two settings to change:

167

Trang 2

• The print titles option determines if the heading rows and columns appear at the topand left on each printed page.

• The row labels option determines if row labels are repeated if their items continue onanother page

Setting Print Titles

Before you turn on this option, clear any entries for row and column print titles on the sheet, as described in the following steps If either of these boxes contains an entry, the SetPrint Titles option won’t be applied for the pivot table

Titles The Page Setup dialog box opens with the Sheet tab activated

boxes, and then click OK

Repeating Row Labels

You can change a pivot table option so the labels appear on each page This option has noeffect if the pivot table is in the Compact Form layout, so if one of the other report layouts isn’talready applied, the first step is to select one of them

Note This setting will have no effect if the pivot table is in the Tabular Form layout and the option forMerge Labels is turned on

click Report Layout

changes to show each field in the Row Labels area in a separate column, instead of allfields in a single column

then click OK

see the changes to the report setup Headings repeat on all pages, and the row labelsrepeat if their items continue on another page In Figure 9-1, the Banana label isrepeated at the top of Page 2

Trang 3

Note If you zoom in or out in Print Preview, the repeated row labels may disappear temporarily.

Figure 9-1.Headings and row labels repeat in print preview.

How It Works

When you turn on the Set Print Titles option, it adds settings to the Print Titles boxes in the

Page Setup dialog box, on the Sheet tab To see the settings, on the Ribbon’s Page Layout tab,

in the Page Setup group, click Print Titles

Caution If you clear the Print Titles settings in the Page Setup dialog box after turning on the Set Print

Titles option, you have to turn the Set Print Titles option off, and then turn it back on, for it to take effect

Only one pivot table per worksheet can have the Set Print Titles option selected If the

set-ting is turned on in one pivot table, the option is unavailable in the PivotTable Options dialog

box for other pivot tables (see Figure 9-2)

Figure 9-2.The Set Print Titles option is unavailable.

When the Set Print Titles option is selected, the report filter, row labels, and column labels

print on every page If multiple pivot tables are on the worksheet, or other data, the pivot table

headings also print with those

Trang 4

9.2 Setting the Print Area to Fit the Pivot Table

If you’re setting a print area because other items are on the sheet that you don’t want toprint, move those items to another sheet, if possible, so you can print the pivot table separately

If the items must remain on the same sheet as the pivot table, use the following technique

to quickly set a print area that encompasses the entire pivot table:

click Select, and then click Entire PivotTable

click Set Print Area

Tip You can add Select Entire PivotTable and Set Print Area buttons to the Quick Access Toolbar

9.3 Printing the Pivot Table for Each Report Filter Item

Problem

Several stores carry your products, and you were asked to send each store manager a printedcopy of the pivot table, customized to show their sales results You added the Store field tothe Report Filter area, and you can select a store in the report filter, to show its totals in thepivot table, and then print the worksheet However, you’d like to find a more efficient way toprint the reports, because you’ll have to do this each week This problem is based on the

Solution

You can use the Show Report Filter Pages feature to create a worksheet for each item in theStore report filter field Then, you can group the worksheets and print them:

Trang 5

Tip Before using the Show Report Filter Pages command, select (All) from the Store report filter If a store

is selected, a worksheet will not be created for that store

click the arrow for Options, and then click Show Report Filter Pages (see Figure 9-3)

Figure 9-3.Show Report Filter Pages command

worksheet with a copy of the pivot table is then created for each store, with the store’s

name on the sheet tab, and that store is selected in the report filter

left, and then scroll to see the last store’s sheet tab Hold the Shift key, and click the last

store’s sheet tab

Caution While the sheets are grouped, any changes you make to the active sheet are also made to the

other sheets in the group

Ribbon’s Page Layout tab, in the Page Setup group, click the commands to set the

mar-gins, orientation, or other options To open the Page Setup dialog box, click the dialog

launcher at the bottom right of the Page Setup group (see Figure 9-4)

Figure 9-4.Page Setup dialog launcher

Trang 6

5. To print the grouped sheets, click the Microsoft Office Button, and then click Print.

without saving the changes

9.4 Printing Field Items: Starting Each Item on a New Page

Problem

Your pivot table has Store and Product in the Row Labels area, and when you print your pivottable, you want each store’s data to start on a new page This enables you to print the entirereport, and send each store its own section This problem is based on the RegionSales_09.xlsxworkbook

Solution

You can change a setting in the Store field, so each item starts on a new page in the printedreport:

Page Break After Each Item

Tip When starting each item on a new page, your pivot table may be easier to understand if you set thepivot table print titles, as described in Section 9.1 This repeats the pivot table headings on each page, sothey’re visible with each store’s data

Notes

Using the Insert Page Break After Each Item setting won’t ensure all items for a field fit on onepage It only ensures the next item will start on a new page For fields with many items, two ormore pages may be required

If several of the fields have a short list of items, your printed report could end up using anexcessive amount of paper with this setting You may prefer to turn the setting off and manu-ally adjust the page breaks in Page Break Preview On the Ribbon’s View tab, in the WorkbookViews group, click Page Break Preview Dashed lines indicate an automatic page break andsolid lines are manual page breaks To move a page break, point to it, and drag up or down onthe page

Note You can’t move or delete the page breaks created by the Insert Page Break After Each Item setting

Trang 7

9.5 Printing in Black and White

Problem

You applied the PivotTable Style Medium 16, which has a blue fill color in the cells, and it has

black headings with white text This style is attractive on the worksheet, but it’s difficult to readwhen you print it on your black and white printer You’d like to print the worksheet without all

the shading, so it’s easy to read and uses less toner or printer ink This problem is based on the

Solution

You can change a page setup option, so the shading is removed when printing:

Page Setup group

the text is in black font, and all the fill color is removed from the cells

9.6 Extracting Underlying Data for a Value Cell

Problem

Your pivot table summarizes discount amounts per store, for each category The Category field

is in the Column Labels area, Store is in the Row Labels area, and Discount is in the Values area,

as Sum of Discount One store shows a very high discount total for the Cookies category, and

you’d like to see more detail on those orders None of the other stores is close to this amount,

and you wonder if an error occurred in the data, or if there’s another cause for the high amount

This problem is based on the RegionSales_09.xlsx workbook

Solution

For pivot tables based on non-OLAP source data, you can use the pivot table’s Show Details

feature to extract the source data For this example, in the pivot table, simply double-click the

cell that contains the high discount total

The Show Details feature extracts the records that contribute to the summarized data, and

sends the records to a new sheet in the active workbook On that sheet, you can examine the

records to see if a problem exists

Tip Instead of double-clicking a cell, you can right-click a cell in the Values area of the pivot table, and

then, in the context menu, click Show Details

Trang 8

If you double-click a cell in the pivot table, you may see an error message that says,

“Cannot change this part of a PivotTable report.” The Show Details feature may be turned off

in the PivotTable Options dialog box To turn it on, follow these steps:

the PivotTable Options dialog box

How It Works

The Show Details feature uses the information stored in the pivot table’s pivot cache to create

a new sheet that shows the related records from the original source data It’s a good way toinvestigate anomalies in the summarized data

The extracted records are copies of the original records in the source data for the pivottable They are not connected to the original records or to the pivot table

Note If you make changes in the exported records, this will have no effect on the pivot table, and thechanges will not be reflected in the original records

If Show Details is used in a pivot table, all columns from the source data are shown, notjust the fields currently in the pivot table layout

A new worksheet is automatically created for the extracted records; you can’t change asetting to control where the extracted records are placed

9.7 Re-creating the Source Data Table

Problem

Someone accidentally deleted the worksheet that contained the source data for your pivottable, and you would like to re-create it (Yes, you know you should have kept a backup copy!)This problem is based on the SourceData.xlsx workbook

Solution

You may be able to use the pivot table’s Show Details feature to re-create the source data:

should have (All) selected, and the (Select All) item should be checked in each of therow and column fields To clear all the filters, on the Ribbon’s Options tab, in theActions group, click Clear, and then click Clear Filters

Tip You don’t need to include all fields in the pivot table to see them in the Show Details output A pivottable with just one field in the Values area, and nothing in the Row Labels, Column Labels, or Report Filterareas, can output all the source data when the grand total cell is double-clicked

Trang 9

2. On the Ribbon’s Design tab, in the Layout group, click Grand Totals, and then click On

For Rows and Columns

This should create a new sheet with all the records from the original source data If the

source table contained formulas, then you have to re-create them, as the Show Details feature

exports the data only If the Show Details feature doesn’t work, check that the Show Details

feature is enabled, as described in Section 9.6

The original records can’t be re-created if the source data was not saved with the file This

option is set in the PivotTable Options dialog box, on the Data tab

How It Works

The Show Details feature, where available, creates a new worksheet with the records from the

source data included in the amount shown in the double-clicked cell The columns are in the

same order as those in the source data, and the list is formatted with the default Table style for

the workbook

The records exported in the Show Details process are from the current pivot cache If you

had made changes to the source data, but you hadn’t yet updated the pivot table, those

changes wouldn’t be reflected in the exported records

To see the name of the new Excel Table, select a cell in the Excel Table On the Ribbon’s

Design tab, the Table Name is visible in the Properties group, at the far left You can change

that name to the same name as the Excel Table that originally held the source data, and the

pivot cache may automatically connect to the new source data If not, you can connect to the

new source range:

Source In the Table/Range box, you can see the name of the original source table

Tip If your pivot table is based on a named range, you may have to redefine the named range if the

origi-nal range was deleted

9.8 Formatting the Extracted Data

Problem

When you use the Show Details feature, the underlying data is exported to a table in a new

worksheet You don’t like the blue formatting that’s used on the new table, and you have to

spend time formatting each set of records you extract You’d like the table formatted

auto-matically, using a different table style This problem is based on the RegionSales_09.xlsx

workbook

Trang 10

The extracted records are formatted with the default Table Style for the workbook To change

to a different default style, follow these steps:

the Table Styles gallery

Now, when you use the Show Details feature, the extracted records are stored in an ExcelTable that uses the new default table style

Changing the default table style does not affect the number and date formatting in theextracted records All the fields in the extracted data use the General number format, or the ShortDate format There’s no way to control the format of the data exported during a Show Detailsoperation After the data is exported, you can format the results

To manually format the data, use the Format Painter button on the Ribbon’s Home tab

to copy the formatting from the source Excel Table and apply it to the new table

9.9 Deleting Sheets Created by Extracted Data

Problem

When you use the Show Details feature, data is exported to a new worksheet This creates extrawork for you, as you have to delete all the created sheets before closing the workbook You’dlike a quick way to delete the sheets, so they don’t clutter the workbook This problem is based

on the RegionSales_09.xlsx workbook

Solution

Save the workbook just before you use the Show Details feature Then, close the workbookwithout saving the changes, after viewing the additional sheets created by the Show Detailsfeature Or, save the workbook with a new name to preserve the original workbook without theextra worksheets

Note A new worksheet is automatically created for the extracted records; you can’t control where theextracted records are placed

9.10 Using GetPivotData: Automatically Inserting a Formula

Problem

You want to refer to a pivot table cell in one of your worksheet formulas, so you can performcalculations using the summarized data When you type an equal sign, and then click a cell inthe pivot table, Excel inserts a GetPivotData formula:

Trang 11

When you try to copy the formula down the worksheet, the results are the same in every row

You would prefer a simple cell reference, like =B4 This problem is based on the Insert.xlsx

workbook

Solution

Instead of typing an equal sign, and then clicking a cell in the pivot table, you can type the cell

reference yourself For example, type =B4 instead of clicking Cell B4 to create the reference.

How It Works

The GetPivotData worksheet function extracts data from the pivot table for a specific pivot

field and pivot item By default, a GetPivotData formula is automatically created when you

refer to a pivot table cell in a worksheet formula You can turn this feature on or off

Although the GetPivotData formula looks complex, and you’re more comfortable using

a simple cell reference, you may get more reliable results by using the GetPivotData function,

especially if you plan to add items to the pivot table source

If you refer to a cell in the pivot table by using a cell reference, the result is whatever is

currently in that cell Today, Cell B15 might contain the Grand Total for Sum of TotalPrice but,

tomorrow, it may contain the Count of Orders for Cookies in the East Region If you use a

GetPivotData formula, it returns the result from the correct location in the table, as long as

the referenced fields are still in the pivot table If the referenced fields aren’t visible in the

pivot table, then the formula returns an error instead of incorrect data

Tip To ensure the referenced fields and items remain visible, you could create a pivot table that is a

copy of the main pivot table and stored on a hidden sheet In your GetPivotData formulas, refer to this

hid-den pivot table Users can change the layout of the main pivot table, and it won’t affect your GetPivotData

would return the grand total for the TotalPrice values in the pivot table located at Cell A3

Tip For non-OLAP-based pivot tables, the data_field argument can be the displayed name, for example,

Sum of TotalPrice, or the field name, TotalPrice For an OLAP-based pivot table, use the name as displayed

in the Pivot Field list, for example, Sum of TotalPrice

Ngày đăng: 09/10/2013, 12:20

TỪ KHÓA LIÊN QUAN