LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default pivot table calculation

hi all,

im trying to create a datafield for pivot table in vba, which is
sumproduct from two other fields..... so far, i have coded as shown
below:

Code:


strDataField = "No_Of_Units * Unit_Value"
pivot.CalculatedFields.Add "TotalUnitValue", strDataField, True
Set pv = pivot.PivotFields("TotalUnitValue")
pv.Orientation = xlDataField
pv.Position = 1

however, it calculates the product of sum of each fields, instead of
the sum of the product of each item in the field (the underlying
data)....

say i have:
unit value, no_of_units
1,2
2,3
3,4

what i wanted is sum of (1*2) + (2*3) + (3*4).
but what that piece of code gave me was (1+2+3) *(2*3*4)

anyone help is greatly appreciated!

-ted-

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Calculation Faboboren Excel Discussion (Misc queries) 0 August 11th 09 06:46 PM
Pivot Table Calculation Kevin Excel Discussion (Misc queries) 1 November 2nd 08 06:46 PM
Pivot Table % Calculation cockatoo Excel Discussion (Misc queries) 0 October 21st 08 05:24 PM
How to Add a Calculation to a Pivot Table ? Cheryl B. Excel Worksheet Functions 3 July 15th 05 12:01 AM
Pivot table calculation Arne Everhard Excel Programming 1 July 18th 04 05:33 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"