11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 18: Pivot Tables 511<br />

This workbook, named income and expenses.xlsx, is available on the companion<br />

CD-ROM.<br />

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

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

You may expect to 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”,2007)/GETPIVOTDATA(“Sum of<br />

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

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

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

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

the GETPIVOTDATA 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 layout is changed. Figure 18-41 shows the pivot table<br />

after expanding the years to show the month detail. As you can see, the formulas in column F still<br />

show the correct result even though the referenced cells are in a different location. Had I used simple<br />

cell references, the formula would have returned incorrect results after expanding the years.<br />

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

visible in the pivot table. If you modify the pivot table so that the value returned by<br />

GETPIVOTDATA is no longer visible, the formula returns an error.<br />

You may want to prevent Excel from using the GETPIVOTDATA function when you<br />

point to pivot table cells when creating a formula. If so, choose PivotTable Tools➜<br />

Options➜PivotTable ➜Options➜Generate GetPivot Data (this command is a toggle).

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

Saved successfully!

Ooh no, something went wrong!