Excel Pivot Table: Difference between Two Columns (3 Cases)

Consider the dataset which contains the Sales Report for 2021 and 2022 of some Product Categories, along with Order Date and corresponding States.

Dataset1


Case 1 – Utilizing the Difference from Value Field Settings Option

Step 1 – Create a Pivot Table

  • Select any cell within the dataset.
  • Go to the Insert tab, select PivotTable, and choose From Table/Range.

How to create table

  • Put the dataset in Table/Range and check New Worksheet.
  • Hit OK.

Utilizing Difference from Value Field Settings Option

  • Add (by clicking and dragging) Order Date to the Rows area, Years to the Columns area, and Sales to Values.

Dragging Field

  • The Pivot Table will be as follows.

Utilizing Difference from Value Field Settings Option

Step 2 – Remove the Grand Total Column

  • Go to the PivotTable Analyze tab, select Grand Totals, and choose Off for Rows and Columns.

Removing Grand Total

  • You’ll get the following output.

Utilizing Difference from Value Field Settings Option

Step 3 – Add the Sales Field Again

  • Drag the Sales field to the Values area after the Sum of Sales.

Utilizing Difference from Value Field Settings Option

  • You’ll get two similar Sum of Sales fields for a year.

Utilizing Difference from Value Field Settings Option

Step 4 – Apply the Difference From Option 

  • Right-click on the Sum of Sales2 field and choose Value Field Settings.

Value Field Settings Option

  • Go to Show Values As and choose the Difference From option.
  • Pick Years as the Base field and (previous) as the Base item.
  • Press OK.

Excel Pivot Table Difference between Two Columns Utilizing Difference from Value Field Settings Option

You’ll get the Difference (in the E7:E11 cells) between the Sum of Sales in 2021 and 2022.

Excel Pivot Table Difference between Two Columns Utilizing Difference from Value Field Settings Option

Step 5 – Rename the Field Name and Hide Irrelevant Columns

  • Double-click on the E5 cell to rename the Sum of Sales2 field to Difference.

Rename the Field Name

  • Hide the C column (right-click over the column and choose the Hide option).

Hide Columns

  • Here’s the output.

Excel Pivot Table Difference between Two Columns Utilizing Difference from Value Field Settings Option

  • You can also find the Difference based on the Product Category. Remove the Order Date field from the Rows area and add the Product Category field.

Excel Pivot Table Difference between Two Columns Utilizing Difference from Value Field Settings Option

Read More: Calculate Difference Between Two Rows in Pivot Table


Case 2 – Showing the Difference between Two Columns in Percentages

  • Repeat Steps 1-3 of Case 1 for the dataset.
  • Go to the Value Field Settings and choose the % Difference From option from the Show values as.

Excel Pivot Table Difference between Two Columns Showing Difference between Two Columns in Percentage

  • You’ll get the Difference in % after pressing OK.

Excel Pivot Table Difference between Two Columns Showing Difference between Two Columns in Percentage

Read More: Pivot Table: Percentage Difference between Two Columns


Case 3 – Using a Formula to Show the Difference between Two Columns a Pivot Table

We have Cost and Sales columns in a Sales Report and need to find the Profit or Loss.

Utilizing Difference from Value Field Settings Option

  • Create a Pivot Table.

3rd method

  • Click the Calculated Field… option from the Fields, Items, & Sets in the PivotTable Analyze tab.

Excel Pivot Table Difference between Two Columns Formula to Find Difference between Two Columns

  • Type the Name as Profit and insert the following formula in the Formula box.

=Sales - Cost

  • Double-click over the fields to add inside the formula.
  • Press Add and then OK.

Excel Pivot Table Difference between Two Columns Formula to Find Difference between Two Columns

  • You’ll get the following output.

Excel Pivot Table Difference between Two Columns Formula to Find Difference between Two Columns

  • Get the Sum of Profit yearly and monthly.

Excel Pivot Table Difference between Two Columns Formula to Find Difference between Two Columns


Download the Practice Workbook


<< Go Back to Pivot Table Calculations | Pivot Table in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Abdul Kader
Md. Abdul Kader

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo