Excel 2007 Formulas (Mr. Spreadsheets Bookshelf)
By using a pivot table, you can convert a huge table of data into an attractive printed report. Figure 18-41 shows a small portion of a pivot table that I created from a table that has 25,664 rows of data. This data happens to be my digital music collection, and each row contains information about a single music file: the genre, artist, album, filename, file size, and duration.
The pivot table report created from this data is 119 pages long, and it took about five minutes to set up (and a little longer to fine-tune it).
| On the CD | This workbook, named music list .xlsx, is available on the companion CD-ROM. |
Here's a quick summary of how I created this report:
-
I selected a cell in the table and chose Insert
Tables PivotTable. -
In the Create PivotTable dialog box, I clicked OK to accept the default settings.
-
In the new worksheet, I used the PivotTable Field List and dragged the following fields to the Row Labels area: Genre, Artist, and Album.
-
I dragged these fields to the Values area: Song, Size, and Duration.
-
I used the Data Field Settings dialog box to summarize Song as Count, Size as Sum, and Duration as Sum.
-
I wanted the information in the Size column to display in megabytes, so I formatted the column using this custom number format:
###,###, "Mb";;
-
I wanted the information in the Duration column to display as hours, minutes, and seconds, so I formatted the column using this custom number format:
[h]:mm:ss;;
-
I edited the column headings. For example, I replaced Count of Song with No. Songs.
-
I changed the layout to outline format by choosing PivotTable Tools
Design Layout Report Layout. -
I turned off the field headers by choosing PivotTable Tools
Options Show/Hide Show Field Headers. -
I turned off the buttons by choosing PivotTable Tools
Options Show/Hide +/- Buttons. -
I displayed a blank row after each artist by choosing PivotTable Tools
Design Layout Blank Rows. -
I applied a built-in style by choosing PivotTable Tools
Design PivotTable Styles. -
I increased the font size for the Genre.
-
I went into Page Layout View, and I adjusted the column widths so that the report would fit horizontally on the page.
| Note | Step 14 was actually kind of tricky. I wanted to increase the size of the genre names but leave the subtotals in the same font size. Therefore, I couldn't modify the style for the PivotTable Style I chose. I selected the entire column A and pressed Ctrl+G to bring up the Go To dialog box. I clicked Special to display the Go To Special dialog box. Then I selected the Constants option and clicked OK, which selected only the nonempty cells in column A. I then adjusted the font size for the selected cells. |
Категории