VBA code to create pivot table on quarterly basis

Balajibenz

Board Regular
Joined
Nov 18, 2020
Messages
80
Office Version
  1. 2013
Platform
  1. Windows
Hi People,

I have a data from A to X in sheet1 where there is weekending date in column "E" in format of mm/dd/yyyy. Can someone help me with VBA code to perform below steps.

1. I have sheet named Pivot which needs to be cleared and have new pivot tables with source data from sheet1
2. first pivot table should be for the current month.
3. then code has to look from current month to the months that are al ready completed and needs to have each pivot table for evry completed quarter.
4. if any other month if left between current month and completed quarter the that month needs to have seperate pivot table.
5. lets say we are in month of nov then at top we need to have pivot table for Nov and next to it it should be Oct pivot table. Under Nov pivot table we need to have Q3, Q2 and Q1. If we are in March then there should be 1 pivot table for each month.

below is snapshot of a pivot table as i am not able to upload a data sheet due to acess issues.

Timesheet Data_Oct'20.xlsx
ABCDE
1October'20
2CIO Cluster(Multiple Items)
3ADMYes
4IT/Non-ITIT
5Time Sheet StatusInvoiced
6Time Sheet End Date(Multiple Items)
7
8Sum of Net AmountColumn Labels
9Row LabelsADAMOthersGrand Total
Onshore T&M spend-Summary
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top