PDA

View Full Version : VBA Pivot Grouping help



malleshg24
09-30-2019, 07:47 PM
Hi Team,


Need your help in Creating PivotTable group in ascending order.
Currently not getting in sequence plz assist. Thanks.


Current Result
Row Labels(headers) <5 >30 06-10 10-20 20-30 Grand Total


Expected Result
Row Labels ((headers) <5 06-10 10-20 20-30 >30 Grand Total




Also Can we bring Grand Total Column Top instead of right/Bottom


Thanks for your help in advance.



Regards,
mg

paulked
10-01-2019, 12:12 AM
Have you tried 30+ instead of >30?

p45cal
10-01-2019, 04:54 AM
You can move the groups manually. Since you look like you want to code for this, something like:
With pt
.PivotFields("Team").Orientation = xlRowField
.PivotFields("Six Group").Orientation = xlColumnField
.AddDataField .PivotFields("Sixes"), "Group", xlCount
.PivotFields("Six Group").PivotItems(">30").Position = 5
End With



Subtotals can be moved to the top but I doubt it for grand totals.

paulked
10-01-2019, 05:22 AM
This manual way may guide you https://www.pivot-table.com/2012/06/11/pivot-table-grand-totals-at-top/

malleshg24
10-01-2019, 07:17 PM
Paulked and P45Cal:thumb
Thanks for your help learned some new points from your tips.
Actually there was a problem with my data, I austosorted it and it worked,


Thanks
mg