I am trying to create a trivial pivot table with AppleScript for Excel 2008.
Please see example below. I cannot get the data field to be a sum.
I create the table with the following:
set PTable to make new pivot table at current sheet with properties ¬
{source data:range "Data!A1:H29999", table range1:range "", name:"MyName"}
Then I add the ProdID field as a row field:
add fields to pivot table PTable row fields {"ProdID"} with add to table
But no matter how I try to add the Units_Sold data field, and set it subtotals, it gives me a _count of the ProdID records in the Total column not the _sum of the Units_Sold.
Any help towards how to specify the data area in a pivot table would be greatly appreciated.
Example
Sheet:
ProdID Units_Sold
100 2
100 3
200 5
200 12
Pivot Table:
Sum of Units_Sold
ProdID Total
100 5
200 17