Home > Articles > Home & Office Computing > Microsoft Applications

This chapter is from the book

The Analysis Sheets

I use several worksheets and chart sheets to analyze what’s going on with the sales of my books. For an analysis that looks at the data over time, a pivot table (and pivot chart) is a nearly perfect solution. It collapses the hourly figures that I get from my web queries into more manageable time slices—I find that summarizing by day strikes a good balance between the overwhelming amount of data in an hourly analysis and the lack of detail in a monthly or even weekly analysis. Of course, when your baseline extends over several hundred days, it’s time to start thinking about weeks or months as your unit of analysis.

Figure 1.10 shows one of the pivot tables that I rely on to synthesize the data on sales rankings.

Figure 1.10

Figure 1.10. When you connect this pivot table to a pivot chart, you can start making real sense of the data.

As powerful as pivot tables are—and I believe that pivot tables are the most powerful and flexible tool for data synthesis and analysis available in Excel—they can’t tell when you have changed the underlying data, and (without help) they can’t tell that their underlying data range has added another row.

In contrast, something as simple as the SUM() function can update itself when the underlying values change. If you have entered this formula

  • =SUM(A1:A5)

in some cell, the value it returns changes immediately if you change any of the values in A1:A5. That’s not true of a pivot table that’s based on those cells or any other cell. You have to do something special to refresh the table when the underlying data changes.

But even SUM() won’t change its own argument. If you now put a new value in A6, SUM() doesn’t change itself from SUM(A1:A5) to SUM(A1:A6).

The way I prefer to handle that is by means of dynamic range names. You might already know that you can assign a name to a worksheet range and use that name instead of a range address. If you have given A1:A5 the name Addends, you can use this instead of SUM(A1:A5):

  • =SUM(Addends)

I show you how to name a range shortly. First, you should know that if you define a range properly, you can get it to change its own dimensions when you add a new row or column to it. (Tables, new in Excel 2007, do that automatically, and you should probably investigate their capabilities. I still prefer dynamic range names because of a possibly irrational belief that I can control them better.)

Defining a Dynamic Range Name

Begin by selecting the worksheet that contains the range that you want to name. This step is not strictly necessary, but I usually find it helpful. Then follow these steps:

  1. Click the Ribbon’s Formulas tab.
  2. Click the Define Name button in the Defined Names group. The New Name dialog box shown in Figure 1.11 appears.
    Figure 1.11

    Figure 1.11. You can use a formula instead of an address in the Refers To box.

  3. Enter the name you want to establish in the Name box.
  4. In this case, leave the Scope with the default value of Workbook.
  5. I base the pivot table on the data in my Summary sheet, shown in Figure 1.7. With the Summary sheet’s layout as shown there, type the following formula in the Refers To box:
    • =OFFSET(Summary!$A$2,0,0,COUNTA(Summary!$B:$B),3)
  6. Click OK.

Here’s a quick explanation of the formula. The OFFSET() function returns a range of cells that are offset from an anchor cell. Here, the anchor cell is defined as A2 on the Summary sheet. Notice in Figure 1.7 that cell A2 is where the label “When” is entered, and more labels follow it in row 2, columns B through I. I want to include those labels in the defined range because they’re needed for the pivot table.

The two zeros that follow $A$2 in the OFFSET() function tell Excel how many rows and how many columns away from A2 the resulting range should begin. In this case, because both values are zero, the resulting range is offset by zero rows and zero columns: that is, the range begins at cell A2.

The fourth argument to the OFFSET() function, COUNTA(Summary!$B:$B), tells Excel how many rows to include in the offset range. The COUNTA() function tells Excel to count the number of values in (here) column B on the Summary worksheet. So when the VBA code runs and adds a new value in column B, the COUNTA function counts an additional value and redefines the number of rows in the range. That’s how adding a new row at the bottom of the range causes the definition of the range to increase by one row.

The final argument to the OFFSET() function tells Excel how many columns to include in the result range. Here I want to include three columns: one for the date, one for the Stats book rankings, and one for the BAXL book rankings.

It’s called a dynamic range name because the dimensions of the range can change depending on the number of records or fields, or both, that are added to or removed from the range.

Using the Dynamic Range Name

With the dynamic range name defined, you can use it when you create a pivot table. Here’s how to do that:

  1. Begin by activating a blank worksheet and then click the Ribbon’s Insert tab.
  2. Click Pivot Table in the Tables group. The dialog box shown in Figure 1.12 appears.
    Figure 1.12

    Figure 1.12. Use the dynamic range name you defined in the Table/Range box.

  3. Type the name you supplied in Step 3 of the prior numbered list into the Table/Range box. This causes Excel to use that range as the data source for the pivot table.
  4. Click OK. The PivotTable Field List appears.
  5. Drag the When field into the Row Labels box.
  6. Drag the StatsR field into the Σ Values box.
  7. Drag the BAXLR field into the Σ Values box.
  8. Dismiss the PivotTable Field List by clicking its Close box. The pivot table now appears as shown in Figure 1.13.
    Figure 1.13

    Figure 1.13. You still need to group on date and to show the average instead of the sum.

  9. Right-click in the date column of the pivot table and choose Group from the shortcut menu.
  10. Grouping by Month is the default selection. Click it to deselect it, and click Day to select it instead. Click OK.
  11. The pivot table might seem to disappear from the visible worksheet. That can happen when the grouping operation causes the pivot table to occupy many fewer rows. Just scroll up to it and then right-click in the column for the first book’s rankings. Choose Value Field Settings from the shortcut menu.
  12. Change the summary type from Sum to Average and click OK.
  13. Right-click in the column for the second book’s rankings, choose Value Field Settings, and change the summary type from Sum to Average. Click OK.

The pivot table should now appear as shown in Figure 1.14.

Figure 1.14

Figure 1.14. You can also use the Value Field Settings to select a display format for the summary values in the pivot table.

A pivot table such as the one in Figure 1.14 isn’t very informative by itself. There are too many data points to make any useful inferences from it. Fortunately, it’s easy to create a pivot chart from a pivot table. Just select any cell in the pivot table, click the Ribbon’s Insert tab, and choose (say) a Line chart from the Charts group.

You get a chart embedded in the active worksheet, and you can usually tell more about your data, at least on a macro level, from the chart than directly from the pivot table (see Figure 1.15).

Figure 1.15

Figure 1.15. You usually need to do some tinkering with the pivot chart before it starts to show you what you need to know.

One of the useful aspects of pivot charts is that they don’t need any special handling to keep up with the underlying pivot table. When the pivot table’s data changes, or gets more rows, the pivot chart updates automatically.

You do need a way to force a refresh of the pivot table. There are many ways to handle that. Some are mildly complicated, such as writing a special Worksheet Activate event handler using VBA. That event handler would force a refresh any time you activate the worksheet that contains the pivot table. Probably the simplest way is to right-click any cell in the pivot table and to choose Refresh from the shortcut menu.

Among the tweaks I like to apply to a newly created pivot chart are the following:

  • Right-click an embedded chart, click Move in the shortcut menu, and choose to move the chart to a new sheet.
  • Right-click a data series in the chart and choose to format it. Reduce the width of the lines and change any obnoxious color to a more acceptable one—black, for example.
  • Add a trendline. Right-click a data series and choose Add Trendline from the shortcut menu. In line charts such as the one in Figure 1.15, linear trendlines and moving average trendlines are often very informative. Tinker with the length of a moving average trendline until you get something that smooths out the rough in the series but preserves its basic movement. Chapter 3, “Forecasting with Moving Averages,” and Chapter 4, “Forecasting a Time Series: Smoothing,” provide guidance on selecting the length of a moving average.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020