# Excel: How to Calculate the Difference Between Two Pivot Tables

The following example shows how to calculate the difference between two pivot tables in Excel.

### Example: Calculate Difference Between Two Pivot Tables

Suppose we have the following two pivot tables that show the total sales and returns for different stores during two different years:

Suppose we would like to calculate the difference in the Sum of Sales and Sum of Returns columns between the two pivot tables.

To calculate the difference in the Sum of Sales columns between the two pivot tables for just store A, we can type the following formula:

```=GETPIVOTDATA("Sum of Sales",\$E\$2,"Team","A")-GETPIVOTDATA("Sum of Sales",\$E\$10,"Team","A")
```

The following screenshot shows how to use this formula in practice:

Notice that this formula correctly calculates the difference between the Sum of Sales values between 2020 and 2019 for store A.

Difference = 38 – 16 = 22.

We can change the values in the GETPIVOTDATA formula to calculate the difference between each corresponding value in the two pivot tables:

Note: You can find the complete documentation for the GETPIVOTDATA function in Excel here.

### Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

May 13, 2024
April 25, 2024
April 19, 2024
April 18, 2024

## One Reply to “Excel: How to Calculate the Difference Between Two Pivot Tables”

1. Blake says:

Where did the term “Team” come from in your formulas?