Pivot table values

Sep 12, 2013 at 8:21 AM
I have tried your example on pivot tables and it works fine. My question is how do you get the other types of values on the pivot tables beside the Add? Lets say one wants the Count of items under values or the Average of items.
Sep 30, 2013 at 1:30 PM
Can anyone help with example on pivot table - under values to have a count of items instead of addition or average values
Oct 1, 2013 at 1:07 PM
Use the SetSummaryFormula() method on an IXLPivotValue object by passing it a value from the XLPivotSummary enum.
For example:
pivotTable.Values.Add("Number").SetSummaryFormula(XLPivotSummary.Count);
where "Number" is the column that you want to count.

Here are the values to the XLPivotSummary enum:
public enum XLPivotSummary
{
    Sum,
    Count,
    Average,
    Minimum,
    Maximum,
    Product,
    CountNumbers,
    StandardDeviation,
    PopulationStandardDeviation,
    Variance,
    PopulationVariance,
}
My problem is that I can't get large pivot tables to work at all.
Oct 4, 2013 at 7:37 AM
Thanks man! it works like charm.
Is it possible to have more than one PivotTable in one workbook, seems I am ending up with a corrupted excel file if I create more than one pivotTable in a workbook.