You are previewing Pivot Table Data Crunching for Microsoft.
O'Reilly logo
Pivot Table Data Crunching for Microsoft

Book Description

This book consolidates all the best functionality of pivot tables into one guide that provides you with a meaningful tutorial, offering practical solutions to day-to-day problems.

Within just the first 2 chapters, you will be creating basic pivot tables, increasing productivity, and producing reports in minutes instead of hours.

Within the first 6 chapters, you will learn how to use pivot tables to quickly highlight your top 10 customers or bottom 5 products in profitability; quickly create analysis comparing sales this period to last period by product or region or both; easily summarize daily transactional data by month or quarter or year in a few mouse clicks–all without knowing any formulas!

By the end of the book, you will truly be a pivot table guru, automating pivot tables using VBA, creating pivot tables with external data in OLAP cubes, and even creating dynamic reporting systems so that your managers can answer their own queries with a few mouse clicks.

• Take advantage of the numerous pivot table recipes

• Create powerful summary reports in seconds

• Build ad-hoc query tools with ease

• Enhance your Executive Reporting

• Filter reports to top 10 customers or products

• Add dynamic charts to reports

• Quickly summarize daily data by month, quarter, or year

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1              Pivot Table Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . .11

2              Creating a Basic Pivot Table . . . . . . . . . . . . . . . . . . . . . . . . . .21

3              Customizing a Pivot Table . . . . . . . . . . . . . . . . . . . . . . . . . . . .45

4              Controlling the Way You View Your Pivot Data . . . . . . . . . . . .83

5              Performing Calculations Within Your Pivot Tables . . . . . . . . 117

6              Using Pivot Charts and Other Visualizations . . . . . . . . . . . . .141

7              Analyzing Disparate Data Sources with Pivot Tables . . . . . . 167

8              Sharing Pivot Tables with Others . . . . . . . . . . . . . . . . . . . . . .189

9              Working with and Analyzing OLAP Data . . . . . . . . . . . . . . . . 201

10           Enhancing Your Pivot Table Reports with Macros . . . . . . . . .215

11           Using VBA to Create Pivot Tables . . . . . . . . . . . . . . . . . . . . . 231

12           Common Pivot Table Issues and Questions . . . . . . . . . . . . . .291

A             Finding Pivot Table Commands on the Ribbon . . . . . . . . . . . .315

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Authors
  3. Acknowledgments
  4. We Want to Hear from You!
    1. Reader Services
  5. Introduction
    1. What You Will Learn from This Book
    2. What Is New in Excel 2007’s Pivot Tables
    3. Skills Required to Use This Book
    4. The Invention of the Pivot Table
    5. Sample Files Used in This Book
    6. Conventions Used in This Book
      1. Referring to Ribbon Commands
      2. Special Elements
  6. 1. Pivot Table Fundamentals
    1. What Is a Pivot Table?
    2. Why Should You Use a Pivot Table?
    3. When Should You Use a Pivot Table?
    4. The Anatomy of a Pivot Table
      1. Values Area
      2. Row Area
      3. Column Area
      4. Report Filter Area
    5. Pivot Tables Behind the Scenes
    6. Limitations of Pivot Table Reports
      1. A Word About Compatibility
    7. Next Steps
  7. 2. Creating a Basic Pivot Table
    1. Preparing Your Data for Pivot Table Reporting
      1. Ensure Your Data Is in a Tabular Layout
      2. Avoid Storing Data in Section Headings
      3. Avoid Repeating Groups as Columns
      4. Eliminate Gaps and Blank Cells in Your Data Source
      5. Apply Appropriate Type Formatting to Your Fields
      6. Summary of Good Data Source Design
    2. Creating a Basic Pivot Table
      1. Adding Fields to the Report
      2. Adding Layers to Your Pivot Table
      3. Rearranging Your Pivot Table
      4. Creating a Report Filter
    3. Keeping Up with Changes in Your Data Source
      1. Changes Have Been Made to Your Existing Data Source
      2. Your Data Source’s Range Has Been Expanded with the Addition of Rows or Columns
    4. Sharing the Pivot Cache
      1. Side Effects of Sharing a Pivot Cache
    5. Saving Time with New Pivot Table Tools
      1. Deferring Layout Updates
      2. Starting Over with One Click
      3. Relocating Your Pivot Table
    6. Next Steps
  8. 3. Customizing a Pivot Table
    1. Making Common Cosmetic Changes
      1. Applying a Table Style to Restore Gridlines
      2. Changing the Number Format to Add Thousands Separators
      3. Replacing Blanks with Zeros
      4. Changing a Field Name
    2. Making Layout Changes
      1. Using the New Compact Layout
      2. Using the Outline Form Layout
      3. Using the Traditional Tabular Layout
      4. Controlling Blank Lines, Grand Totals, Subtotals, and Other Settings
    3. Customizing the Pivot Table Appearance with Styles and Themes
      1. Customizing a Style
      2. Choosing a Default Style for Future Pivot Tables
      3. Modifying Styles with Document Themes
    4. Changing Summary Calculations
      1. Understanding Why One Blank Cell Causes a Count
      2. Using Functions Other Than Count or Sum
    5. Adding and Removing Subtotals
      1. Suppress Subtotals When You Have Many Row Fields
      2. Adding Multiple Subtotals for One Field
    6. Using Running Total Options
      1. Display Change from Year to Year with Difference From
      2. Compare One Year to a Prior Year with % Difference From
      3. Track YTD Numbers with Running Total In
      4. Determine How Much Each Line of Business Contributes to the Total
      5. Create Seasonality Reports
      6. Measure Percentage for Two Fields with % of Total
      7. Compare One Line to Another Line Using % Of
      8. Track Relative Importance with the Index Option
    7. Next Steps
  9. 4. Controlling the Way You View Your Pivot Data
    1. Grouping Pivot Fields
      1. Grouping Date Fields
      2. Including Years When Grouping by Months
      3. Grouping Date Fields by Week
      4. Grouping Two Date Fields in One Report
      5. Grouping Numeric Fields
      6. Ungrouping
    2. Looking at the PivotTable Field List
      1. Docking and Undocking the PivotTable Field List
      2. Rearranging the PivotTable Field List
      3. Using the Areas Section Drop-Downs
      4. Using the Fields Drop-Down
    3. Sorting in a Pivot Table
      1. Sorting Using the Sort Icons on the Options Ribbon
      2. Sorting Using the Field List Hidden Drop-Down
      3. Understanding the Effect of Layout Changes on AutoSort
      4. Using a Manual Sort Sequence
      5. Using a Custom List for Sorting
    4. Filtering the Pivot Table
      1. Adding Fields to the Report Filter Area
      2. Choosing One Item from a Report Filter
      3. Choosing Multiple Items from a Report Filter
      4. Quickly Selecting or Clearing All Items from a Filter
      5. Using the Field List Filters
      6. Using Label Filters
      7. Using Date Filters
      8. Using Value Filters
    5. Next Steps
  10. 5. Performing Calculations Within Your Pivot Tables
    1. Introducing Calculated Fields and Calculated Items
      1. Method 1: Manually Add the Calculated Field to Your Data Source
      2. Method 2: Use a Formula Outside Your Pivot Table to Create the Calculated Field
      3. Method 3: Insert a Calculated Field Directly into Your Pivot Table
    2. Creating Your First Calculated Field
    3. Creating Your First Calculated Item
    4. Understanding Rules and Shortcomings of Pivot Table Calculations
      1. Remembering the Order of Operator Precedence
      2. Using Cell References and Named Ranges
      3. Using Worksheet Functions
      4. Using Constants
      5. Referencing Totals
      6. Rules Specific to Calculated Fields
      7. Rules Specific to Calculated Items
    5. Managing and Maintaining Your Pivot Table Calculations
      1. Editing and Deleting Your Pivot Table Calculations
      2. Changing the Solve Order of Your Calculated Items
      3. Documenting Your Formulas
    6. Next Steps
  11. 6. Using Pivot Charts and Other Visualizations
    1. What Is a Pivot Chart...Really?
    2. Creating Your First Pivot Chart
    3. Keeping Pivot Chart Rules in Mind
      1. Changes in the Underlying Pivot Table Affect Your Pivot Chart
      2. The Placement of Data Fields in Your Pivot Table May Not Be Best Suited for Your Pivot Chart
      3. A Few Formatting Limitations Still Exist in Excel 2007
    4. Examining Alternatives to Using Pivot Charts
      1. Method 1: Turn Your Pivot Table into Hard Values
      2. Method 2: Delete the Underlying Pivot Table
      3. Method 3: Distribute a Picture of the Pivot Chart
      4. Method 4: Use Cells Linked Back to the Pivot Table as the Source Data for Your Chart
    5. Using Conditional Formatting with Pivot Tables
    6. Next Steps
  12. 7. Analyzing Disparate Data Sources with Pivot Tables
    1. Using Multiple Consolidation Ranges
    2. Analyzing the Anatomy of a Multiple Consolidation Range Pivot Table
      1. The Row Field
      2. The Column Field
      3. The Value Field
      4. The Page Fields
      5. Redefining Your Pivot Table
    3. Building a Pivot Table Using External Data Sources
      1. Building a Pivot Table with Microsoft Access Data
      2. Building a Pivot Table with SQL Server Data
    4. Next Steps
  13. 8. Sharing Pivot Tables with Others
    1. Sharing a Pivot Table with Other Versions of Office
      1. Features Unavailable in Excel 2003 Pivot Tables
      2. Excel 2007 Compatibility Mode
      3. No Downgrade Path Available from Version 12 Pivot Tables
      4. Strategies for Sharing Pivot Tables
    2. Saving Pivot Tables to the Web
    3. Publishing Pivot Tables to Excel Services
      1. Requirements to Render Spreadsheets with Excel Services
      2. Preparing Your Spreadsheet for Excel Services
      3. Publishing Your Spreadsheet to Excel Services
      4. What the End User Sees in Excel Services
      5. What You Cannot Do with Excel Services
        1. Features Disallowed in Excel Services
        2. Items Ignored by Excel Services
      6. Viewing the Pivot Table in the Browser
    4. Next Steps
  14. 9. Working with and Analyzing OLAP Data
    1. What Is OLAP?
    2. Connecting to an OLAP Cube
    3. Understanding the Structure of an OLAP Cube
    4. Understanding Limitations of OLAP Pivot Tables
    5. Creating Offline Cubes
    6. Breaking Out of the Pivot Table Mold with Cube Functions
    7. Next Steps
  15. 10. Enhancing Your Pivot Table Reports with Macros
    1. Why Use Macros with Your Pivot Table Reports?
    2. Recording Your First Macro
    3. Creating a User Interface with Form Controls
    4. Altering a Recorded Macro to Add Functionality
    5. Next Steps
  16. 11. Using VBA to Create Pivot Tables
    1. Introducing VBA
      1. Enabling VBA in Your Copy of Excel
      2. Enabling the Developer Ribbon
      3. Visual Basic Editor
      4. Visual Basic Tools
      5. The Macro Recorder
      6. Understanding Object-Oriented Code
    2. Learning Tricks of the Trade
      1. Writing Code to Handle Any Size Data Range
      2. Using Super-Variables: Object Variables
    3. Understanding Versions
      1. New in Excel 2007
    4. Building a Pivot Table in Excel VBA
      1. Getting a Sum Instead of a Count
      2. Learning Why You Cannot Move or Change Part of a Pivot Report
      3. Determining Size of a Finished Pivot Table
    5. Creating a Report Showing Revenue by Product
      1. Eliminating Blank Cells in the Values Area
      2. Ensuring Table Layout Is Utilized
      3. Controlling the Sort Order with AutoSort
      4. Changing Default Number Format
      5. Suppressing Subtotals for Multiple Row Fields
      6. Suppressing Grand Total for Rows
    6. Handling Additional Annoyances When Creating Your Final Report
      1. Creating a New Workbook to Hold the Report
      2. Creating a Summary on a Blank Report Worksheet
      3. Filling the Outline View
      4. Handling Final Formatting
      5. Adding Subtotals
      6. Putting It All Together
    7. Addressing Issues with Two or More Data Fields
      1. Calculated Data Fields
      2. Calculated Items
    8. Summarizing Date Fields with Grouping
      1. Group by Week
    9. Using Advanced Pivot Table Techniques
      1. Using AutoShow to Produce Executive Overviews
      2. Using ShowDetail to Filter a Recordset
      3. Creating Reports for Each Region or Model
      4. Manually Filtering Two or More Items in a PivotField
    10. Controlling the Sort Order Manually
    11. Using Sum, Average, Count, Min, Max, and More
    12. Creating Report Percentages
      1. Percentage of Total
      2. Percentage Growth from Previous Month
      3. Percentage of a Specific Item
      4. Running Total
    13. Using New Pivot Table Features in Excel 2007
      1. Using the New Filters
      2. Applying a Table Style
      3. Changing the Layout
      4. Applying a Data Visualization
      5. Understanding Special Considerations for Excel 97
    14. Next Steps
  17. 12. Common Pivot Table Issues and Questions
    1. Troubleshooting Common Pivot Table Issues
      1. I keep getting the error “The PivotTable field name is not valid.”
        1. Problem
        2. Solution
      2. When I refreshed my pivot table, my data disappeared
        1. Problem
        2. Solution
      3. My pivot table always uses Count instead of Sum
        1. Problem
        2. Solution
      4. My pivot table constantly adjusts the columns in my workbook to autofit the headings
        1. Problem
        2. Solution
      5. The Defer Layout Update option locked me out of other functionality such as sorting, filtering, and grouping
        1. Problem
        2. Solution
      6. Older versions of Excel do not open my pivot table properly
        1. Problem
        2. Solution
      7. When I try to group a field, I get an error message
        1. Problem
        2. Solution
      8. My pivot table shows the same data item twice
        1. Problem
        2. Solution
      9. Deleted data items still show up in the filter area
        1. Problem
        2. Solution
      10. I refreshed my pivot table, and now my calculated fields are displayed as error values
        1. Problem
        2. Solution
    2. Common Pivot Table Questions
      1. How do I make my pivot table refresh automatically?
      2. How do I refresh all pivot tables in a workbook at the same time?
      3. How can I sort data items in a unique order that is not ascending or descending?
      4. How do I turn my pivot table into hard data?
      5. Is there an easy way to fill the empty cells left by row fields?
      6. Is there an easy way to fill the empty cells left by row fields in many columns?
      7. Why does my pivot chart exclude months for certain data items?
      8. How do I add a rank number field to my pivot table?
      9. How do I hide calculation errors in my pivot table?
      10. How can I reduce the size of my pivot table reports?
      11. How can I easily create a separate pivot table for each market?
      12. How do I avoid the need to constantly redefine my pivot table’s data range?
  18. A. Finding Pivot Table Commands on the Ribbon
    1. Inserting a Pivot Table
    2. Finding Commands from the Legacy PivotTable Toolbar