Info

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

' Ensure that we get zeroes instead of blanks in the data area PT.NullString = "0"

1 Calc the pivot table PT.ManualUpdate = False PT.ManualUpdate = True Ctr = 0

End Sub

The resulting pivot table provides a number of statistics about the average revenue, largest order, smallest order, and so on. The results are shown in Figure 12.42.

Figure 12.42

All five data columns here are various statistics about revenue.From left to right, there is total, count, average, min,and max.

0 0

Post a comment