' Set up the data fields With PT.PivotFields("Revenue") .Orientation = xlDataField .Function = xlSum .Position = 1 .NumberFormat = "#,##0,K" .Name = "Total Revenue" End With With PT.PivotFields("Revenue") .Orientation = xlDataField .Function = xlCount .Position = 2 .NumberFormat = "#,##0" .Name = "Number Orders" End With With PT.PivotFields("Revenue") .Orientation = xlDataField .Function = xlAverage .Position = 3 .NumberFormat = "#,##0" .Name = "Average Revenue" End With With PT.PivotFields("Revenue") .Orientation = xlDataField .Function = xlMin .Position = 4 .NumberFormat = "#,##0" .Name = "Smallest Order" End With With PT.PivotFields("Revenue") .Orientation = xlDataField .Function = xlMax .Position = 5 .NumberFormat = "#,##0" .Name = "Largest Order" End With
The resultant pivot table provides a number of statistics about the average revenue, largest order, smallest order, and so on.
by
updated