CalculatedField in Pivot Table
Posted by Bill on March 14, 2001 5:26 AM
My data has price, quantity sold, quantity on hand, quantity on order, etc.
I have a VBA macro that produces a pivot table which shows these quantities by department.
I want to modify the pivot table to show each of the quantities times the unit price.
The following code runs:
PT.CalculatedFields.Add "DOrd", "=Price*Ord"
But to my surprise, the pivot table first adds up all the quantities for the department, then adds up all the prices for the department, then multiplies these sums together, producing a ridiculous result.
Is there any way to do this calculation correctly in the pivot table?
I realize I could add eight more fields to my table in excel and do the calculation before creating the pivot table.
Thanks in advance,
Bill