18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Analyzing Data with Pivot Tables 35<br />

FIGURE 35.20<br />

The formulas in column F reference cells in the pivot table.<br />

Column F contains formulas and this column is not part of the pivot table. These formulas calculate the<br />

expense-to-income ratio for each year. I created these formulas by pointing to the cells. You may expect to<br />

see this formula in cell F5:<br />

=D5/C5<br />

In fact, the formula in cell F5 is<br />

=GETPIVOTDATA(“Sum of Expenses”,$A$3,”Year”,2004)/GETPIVOTDATA(“Sum of<br />

Income”,$A$3,”Year”,2004)<br />

When you use the pointing technique to create a formula that references a cell in a pivot table, Excel<br />

replaces those simple cell references with a much more complicated GETPIVOTDATA function. If you type<br />

the cell references manually (rather than pointing to them), Excel does not use the GETPIVOTDATA<br />

function.<br />

The reason? Using the GETPIVOTDATA function helps ensure that the formula will continue to reference<br />

the intended cells if the pivot table changed. Figure 35.21 shows the pivot table after expanding the years to<br />

show the month detail. As you can see, the formulas in column F still show the correct result, even though<br />

the references cells are in a different location. Had I used simple cell references, the formula would return<br />

incorrect results after expanding the years.<br />

Using the GETPIVOTDATA function has one caveat: the data that it retrieves must be visible.<br />

If you modify the pivot table so that the value returned by GETPIVOTDATA is no longer visible,<br />

the formula returns an error.<br />

CAUTION<br />

TIP<br />

If, for some reason, you want to prevent Excel from using the GETPIVOTDATA function when<br />

you point to pivot table cells when creating a formula, access the Excel Options dialog box,<br />

select the Formulas tab, and remove the check mark from Use GETPIVOTDATA Function For PivotTable<br />

References.<br />

625

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!