Chapter 5. Customizing PivotTable Fields

Rename a PivotTable Field

PivotTable field names come from the column headings used in the original source data. However, if you are using an external data source, the field names come from the names used in the data source's fields. If you do not like some or all of the field names in your PivotTable, you can rename them. Excel will remember the new names you specify and even preserve them when you refresh or rebuild the PivotTable. Note, however, that Excel does not change the corresponding headings in the source data.

Why rename a field? Usually because the original name is not suitable in some way. For example, many field names consist of multiple words that have been joined to avoid spaces, so you might have field names such as CustomerName and OrderDate. Renaming these fields to Customer Name and Order Date makes them easier to read. Similarly, you might have field names that are all uppercase letters and you might prefer to use title case, instead. Many PivotTable users prefer to change the name of the data field. Excel's default is "Sum of FieldName," where FieldName is the name of the field used in the summary calculation. A better name might use the form "FieldName Total" or something similar.

Rename a PivotTable Field

Note

This chapter uses the PivotTables.xls spreadsheet, available at www.wiley.com/go/pivottablesvb, or you can create your own sample database.

Rename a PivotTable Field
Rename a PivotTable Field
Rename a PivotTable Field

You can also double-click the field button or click the Field Settings button (

Rename a PivotTable Field

The PivotTable Field dialog box appears.

Rename a PivotTable Field

Note

Make sure that the new name you use does not conflict with an existing field name.

Rename a PivotTable Field
Rename a PivotTable Field
Rename a PivotTable Field
Rename a PivotTable Field
Rename a PivotTable Field

Rename a PivotTable Item

The names of the items that appear in the PivotTable's row or column area are the unique values that Excel has extracted from the source data fields you have added to each area. Therefore, because the items come from the data itself, you might think that their names would be unchangeable. That is not true, however. You can rename any field item and Excel will "remember" that the new name corresponds with the original item. Excel preserves your new names even after you refresh or rebuild the PivotTable.

As with field names, you will usually want to rename an item when its existing name is unsuitable. For example, the original name might not be very descriptive, it might be obscure, or it may come from a data source that uses all-uppercase or (more rarely) all-lowercase letters.

You should exercise a bit of caution when renaming items, however. If the people reading your report are familiar with the underlying data, they could become confused if you use names that differ significantly from the originals.

Remember, too, that renaming one or more items might cause the field to lose its current sort order. After you have finished renaming items in the field, you might need to resort the field, as described in the Chapter 4 task "Sort PivotTable Data with AutoSort."

Rename a PivotTable Item

Rename a PivotTable Item
Rename a PivotTable Item
Rename a PivotTable Item
Rename a PivotTable Item
Rename a PivotTable Item
Rename a PivotTable Item

Note

Make sure that the new name you use does not conflict with an existing item name in the same field. If you enter an existing name, Excel switches the position of the two items. In Chapter 4, see the task "Move Row and Column Items."

Rename a PivotTable Item
Rename a PivotTable Item

Format a PivotTable Cell

If you will be sharing your PivotTables with other people, via a network, e-mail, the Web, or a presentation, your report will have much more impact if it is nicely formatted and presented in a readable, eye-catching layout. You can use Excel's cell-formatting tools to apply a wide variety of formats to your PivotTable cells.

By default, Excel applies almost no formatting to PivotTable labels or data. The only exceptions are the borders that separate the PivotTable areas and the Grand Totals, and the special formatting that makes the field headings look like command buttons. However, you are free to modify the formatting for any cell in the PivotTable. For example, you can apply a numeric or date format, or create a custom format, as discussed in detail in the next three tasks of this chapter. You can also change the cell alignment to the left, center, or right, or you can wrap text within the cell. For the cell font, you can change the typeface, style, size, color, and more. You can also change the cell borders and apply background shading, either as a solid color or with a fill pattern.

By the way, the default format that the PivotTable Wizard applies to a new PivotTable is an AutoFormat called PivotTable Classic. Excel offers nearly two dozen PivotTable AutoFormats that enable you to apply a uniform format to an entire PivotTable. For the details, see the Chapter 6 task "Apply an AutoFormat." Excel also has a feature that preserves your formatting when you refresh your PivotTable; see the task "Preserve PivotTable Formatting," also in Chapter 6.

Format a PivotTable Cell

Format a PivotTable Cell
Format a PivotTable Cell

You can also select a range or a PivotTable area.

Note

To learn how to select PivotTable areas, see the Chapter 3 task "Select PivotTable Items."

Format a PivotTable Cell

You can also press Ctrl+1.

Excel displays the Format Cells dialog box.

Format a PivotTable Cell
Format a PivotTable Cell
Format a PivotTable Cell
Format a PivotTable Cell
Format a PivotTable Cell
Format a PivotTable Cell
Format a PivotTable Cell

Excel applies the formatting to the cell.

Apply a Numeric Format to PivotTable Data

You can improve the readability of your PivotTable by applying the appropriate numeric formatting, such as displaying currency amounts with leading dollar signs and displaying large numbers with commas.

Excel offers six categories of numeric formats:

  • Number — Enables you to specify three components: the number of decimal places (0 to 30), whether or not the thousands separator (,) is used, and how negative numbers are displayed. For negative numbers, you can display the number with a leading minus sign, in red, surrounded by parentheses, or in red surrounded by parentheses.

  • Currency — This format is similar to the number format, except that the thousands separator is always used, and you have the option of displaying the numbers with a leading dollar sign ($) or other currency symbol.

  • Accounting — Enables you to select the number of decimal places and whether to display a leading currency symbol, which Excel displays flush-left in the cell. All negative entries are displayed surrounded by parentheses.

  • Percentage — Displays the number multiplied by 100 with a percent sign (%) to the right of the number. For example, .506 is displayed as 50.6%. You can display 0 to 30 decimal places.

  • Fraction — Enables you to express decimal quantities as fractions. There are nine fraction formats in all, including displaying the number as halves, quarters, eighths, sixteenths, tenths, and hundredths.

  • Scientific — Displays the most significant number to the left of the decimal, 2 to 30 decimal places to the right of the decimal, and then the exponent. For example, 123000 is displayed as 1.23E+05.

You can also create custom numeric formats. In Appendix A, see the section "Work with Custom Numeric and Date Formats."

Apply a Numeric Format to PivotTable Data

Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data

You can also press Ctrl+1.

To apply a numeric format to an entire field, double-click the field button and then click Number.

Excel displays the Format Cells dialog box.

Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data
Apply a Numeric Format to PivotTable Data

Excel applies the numeric formatting to the cell or range.

Apply a Date Format to PivotTable Data

If you include dates or times in your PivotTables, you need to make sure that they are presented in a readable, unambiguous format. For example, most people would interpret the date 8/5/06 as August 5, 2006. However, in some countries this date would mean May 8, 2006. Similarly, if you use the time 2:45, do you mean AM or PM? To avoid these kinds of problems, you can apply Excel's built-in date and time formats to a PivotTable cell or range.

The Date format specifies how Excel displays the date components — the day, month, and year — as well as which symbol to use to separate the components. For the month component of the date, Excel can display any of the following: the number (where January is 1, February is 2, and so on) with or without a leading 0; the first letter of the month name (for example, M for March); the abbreviated month name (for example, Mar for March); or the full month name. For the year component, Excel can display either the final two digits (for example, 06 for 2006) or all four digits. You can also choose either a slash (/) or a hyphen (-) to separate the date components. Depending on the location you choose, such as the United States or Canada, you may also be able to include the day of the week or use a period (.) as the date separator.

The Time format specifies which time components — hours, minutes, and seconds — Excel displays. You can also choose whether Excel uses regular time (for example, 1:30:55 PM) or military time (for example, 13:30:55). When you select a regular time format, Excel always includes either AM or PM; when you choose a military time format, Excel does not include AM or PM.

You can also create custom date formats. In Appendix A, see the section "Work with Custom Numeric and Date Formats."

Apply a Date Format to PivotTable Data

Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data

You can also press Ctrl+1.

To apply a date or time format to an entire field, double-click the field button and then click Number.

Excel displays the Format Cells dialog box.

Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data

If you are formatting times, click Time, instead.

Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data
Apply a Date Format to PivotTable Data

Excel applies the date or time formatting to the cell or range.

Apply a Conditional Format to PivotTable Data

Formatting numbers with thousands separators, decimals, or currency symbols is useful because a PivotTable is, in the end, a report, and reports should always look their best. However, the main purpose of a PivotTable is to perform data analysis, and regular numeric formatting achieves that goal only insofar as it helps you and others read and understand the report. However, if you want to extend the analytic capabilities of your PivotTables, you need to turn to a more advanced technique called conditional formatting.

The idea behind conditional formatting is that you want particular values in your PivotTable results to stand out from the others. For example, if your PivotTable tracks product inventory, you might want to be alerted when the inventory of any item falls below some critical value. Similarly, you might want to track the total amount sold by your salespeople and be alerted when an employee's results exceed some value so that, say, a bonus can be awarded.

Conditional formatting enables you to achieve these and similar results. With a conditional format applied to some or all of the PivotTable's data area, Excel examines the numbers and then applies formatting — a font, border, and pattern that you specify — to any cells that match your criteria. By applying, say, a bold font, thick cell border, and a background color to results that satisfy your criteria, you can find those important results with a quick glance at your PivotTable.

Note, however, that conditional formatting only works with PivotTables that have a static layout. The conditional formatting is a property of the cells to which you apply it, not of the PivotTable. So, for example, if you pivot the column field into the row area, your conditional formatting does not travel with the field.

Apply a Conditional Format to PivotTable Data

Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data

The Conditional Formatting dialog box appears.

Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data

Excel displays the Format Cells dialog box.

Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data

Excel returns you to the Conditional Formatting dialog box.

Apply a Conditional Format to PivotTable Data
Apply a Conditional Format to PivotTable Data

Excel applies the conditional formatting to the range.

Show Items with No Data

A PivotTable report is meant to be a succinct summary of a large quantity of data. One way that Excel increases the succinctness of a PivotTable is to exclude from the report any items that have no data. This is usually the behavior that you want, but it can cause some problems with certain kinds of reports.

One of the problems that comes up when some items have no data concerns filtering the report using a page field. For example, suppose there are two items in the page field, and that a particular row item has data for the first page field item, but it has no data for the second page field item. When you switch pages, your PivotTable layout will change because Excel removes the row field item from the report when you filter on the second page field.

Another problem occurs when you group the PivotTable results. If no results fall within a particular grouping, Excel does not display the grouping.

In both cases, the exclusion of a field item or grouping can be confusing and, in any case, you may be interested in seeing items or groupings that have no data.

You can work around these problems by forcing Excel to always show field items that have no data, as described in this task.

Show Items with No Data

Show Items with No Data
Show Items with No Data
Show Items with No Data

You can also double-click the field button or click the Field Settings button (

Show Items with No Data

The PivotTable Field dialog box appears.

Show Items with No Data
Show Items with No Data
Show Items with No Data

Excel displays the PivotTable report with items that have no data.

Exclude Items from a Page Field

You can configure your PivotTable to hide multiple page field items and thus display a subset of the pages in your PivotTable results.

In a default PivotTable that includes a page field, Excel displays the results for all items in the page field. In Chapter 4, you learned how to display the results for a single page; see the task "Display a Different Page." However, there may be times when you need to display the results for more than one page, although not all the pages. For example, you may know that the results from one or more pages are incomplete or inaccurate, and so should not be included in the report. Alternatively, your data analysis may require that you view the PivotTable results for only a subset of pages.

For these and similar situations, Excel enables you to customize the page field to exclude one or more items. Excel then redisplays the PivotTable without showing those items or including their results in the PivotTable totals. However, it is possible to include the results of hidden page fields in your PivotTable totals. In Chapter 7, see the task "Include Hidden Pages in PivotTable Results."

Exclude Items from a Page Field

Exclude Items from a Page Field
Exclude Items from a Page Field
Exclude Items from a Page Field

You can also double-click the field button or click the Field Settings button (

Exclude Items from a Page Field

The PivotTable Field dialog box appears.

Exclude Items from a Page Field
Exclude Items from a Page Field
Exclude Items from a Page Field

Excel redisplays the PivotTable without the page field items you selected.

Exclude Items from a Page Field
..................Content has been hidden....................

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