How do I subtract two columns of data in a pivot table?
The column name is LE and the data is Sum of Amount…
Thanks.
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Calculated Column in Pivot Table
I think I want to calculate an item because those fields don’t come up as options. So, don’t I want to do this instead of calculate a field??
You did not mention the Excel version. FOr 2003 and below: click anywhere in the pivot table. Then on the pivot table toolbar, select PivotTable, Formulas, Calculated field. That dialog speaks for itself I think.
Ok. Here is a picture. I want to subtract the March LE data from the December LE data – column f from column e.
You can’t use the data fields of the pivot table in a calculated field.
It might be helpful of you posted (a stripped down copy of) your workbook, with an indication of what you want.
Click in the pivot table.
Start the Pivot Table Wizard.
Click Layout…
Add the Amount field to the Data area, since there is already an instance of Amount there, the new one will be called Sumof Amount2.
Double-click the Sum of Amount2 button.
Change the name if you like, then click Options>>.
From the “Show data as” dropdown, select “Difference with”.
Select LE in the Base Field list.
Select (previous) in the Base Item list.
Click OK, OK, Finish.
Hans, this didn’t work… I am wanting to add an extra column to calculate this…
Does this change your answer???
Mitch
Click in the pivot table.
Start the Pivot Table Wizard.
Click Layout…
Add the Amount field to the Data area, since there is already an instance of Amount there, the new one will be called Sumof Amount2.
Double-click the Sum of Amount2 button.
Change the name if you like, then click Options>>.
From the “Show data as” dropdown, select “Difference with”.
Select LE in the Base Field list.
Select (previous) in the Base Item list.
Click OK, OK, Finish.
Hans, it looks like I asked this same thing back on July 25, 2008. Below is your reply. I am trying a similar approach to this table, but it locks up my PC taking up all the CPU. I let it run for an hour and it was finished but didn’t show a result…
“Sorry, I interpreted your “I have two sets of columnar data” in a different way than you intended it. What you need is a calculated item instead of a calculated formula.
– Click in one of the values of version.
– From the Pivot Table toolbar, select Pivot Table | Formulas | Calculated Item…
– Enter a name for the formula in the box at the top.
– Enter the following formula in the formula box:
=versions[2008 OP]-versions[Sept LE]
– Make sure that you use the names exactly as they are in the data.
– Click Add, then OK. ”
Yes, in the sense that it can’t be done in the pivot table as far as I know. You could add formulas to the right of the pivot table to calculate the difference, but they wouldn’t be updated correctly if you changed the layout of the pivot table.
Click on Jan LE or Mar LE (or in one of the row fields)
Select Pivot Table | Formulas | Calculated Item from the Pivot Table toolbar.
Type a name for the field, e.g. Variance.
Edit the formula so that it consists only of =
Select Jan LE item in the list ot items, then click Add Item.
Type – after it in the formula.
Select Mar LE item in the list ot items, then click Add Item.
The formula should now read =’Jan LE’-‘Mar LE’
Click Add, then click OK
BTW you can reduce the size of the workbook significantly by basing it on the data table only instead of on entire columns.
See the attached version.
Hans, I was able to get it to work also on the smaller subset of data I posted. When I try to do it on the full data set, it never finishes and takes up 100% of the CPU for hours…
I see your comment below, “BTW you can reduce the size of the workbook significantly by basing it on the data table only instead of on entire columns.” Maybe this would fix the problem with the full data set.
How do I do what you are referring to?
Mitch
Click on Jan LE or Mar LE (or in one of the row fields)
Select Pivot Table | Formulas | Calculated Item from the Pivot Table toolbar.
Type a name for the field, e.g. Variance.
Edit the formula so that it consists only of =
Select Jan LE item in the list ot items, then click Add Item.
Type – after it in the formula.
Select Mar LE item in the list ot items, then click Add Item.
The formula should now read =’Jan LE’-‘Mar LE’
Click Add, then click OKBTW you can reduce the size of the workbook significantly by basing it on the data table only instead of on entire columns.
See the attached version.
How do I do what you are referring to?
Click anywhere in the pivot table.
Select Pivot Table | Pivot Table Wizard from the Pivot Table toolbar.
Click Back until you see the range the pivot table is based on. This range consists of entire columns. Clear this, and point to the data range.
Finally, click Finish.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications