# How to calculate the difference using a pivot table

Although pivot tables are very useful tools for analyzing and presenting data in Excel, alas, working with them can be confusing. Some functions, such as calculating the difference, must be performed in a special way in order to work correctly. The process is not well documented in the Excel manual, so here's how to calculate the difference in a PivotTable using third-party formulas.

## Steps

### The data can be on the same sheet as the table or on a different one

#### Step 5. Insert a column for calculating the difference

• For example, suppose your table contains a cell that contains the difference between Column G and Column H, and both columns contain numeric values.
• Right-click on column I and choose Insert Column from the pop-up menu. The column will be inserted to the right of H, and all columns to the right of it will be shifted to the right along with the data.

"

#### Step 7. Create a formula in the first cell of the column to calculate the difference

• Using the example above, the formula should look like "= H1-G1" if you subtract column G data from column H data; "= G1-H1" if vice versa.
• Make sure the formulas are spelled correctly so that you get a positive or negative number, depending on your desire.

#### Step 10. Modify the original data for your pivot table

• In Excel 2003, restart the PivotTable Wizard by clicking inside the PivotTable and choosing Wizard from the pop-up menu.
• In Excel 2007 or 2010, click the Change Data Source button on the Pivot tab on the Tools menu.
• Click and drag a selection rectangle or simply enter a range formula in the Range box to include the desired cells.