Calculated Items in Pivot Tables - only sum fields if present in data

jimsjams

New Member
Joined
Nov 6, 2008
Messages
29
Hello,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
I’ve been thinking about this for ages and just can’t think of any way around this – I’m sure someone out there must have some genius way of doing this.
<o:p> </o:p>
I’m coding some VBA to make some Calculated Fields in a pivot table each day.
<o:p> </o:p>
The Calculated Field isn’t complicated – it’s just going to add some fields together. The problem is that as the underlying data changes each day, not all the fields I want to sum will appear every day.
<o:p> </o:p>
For example:
Calculated Item ‘All Fields’ = Field 1 + Field 2 + Field 3 + Field AA + Field B
This will work fine until one day my data might not contain any entries for (say) Field 3 and the calculated field won’t work.
<o:p> </o:p>
Is there any way I can check to see if there are entries for each field I want to sum in the data, and then only sum those items that appear?
<o:p> </o:p>
Hope this makes sense. Let me know if you need anything else.
<o:p> </o:p>
Thanks for any help / suggestions / thoughts.
<o:p> </o:p>
James
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top