VBA code to map the pivot data to output sheet

Wafee

Board Regular
Joined
May 27, 2020
Messages
104
Office Version
  1. 2013
Platform
  1. Windows
Hi, Can someone help me with the below requirement. my job is at stake as it depends on this automation. Thank you in advance.

I am creating below pivot table where data is based on weekending dates and grouped in to months. In column A bold ones are senior managers and list below them are their reporting managers.

UnapprovedTime.xlsm
ABCDEFGHIJKLM
1Sum of DURATIONColumn Labels
2SeptemberSeptember TotalOctoberOctober TotalGrand Total
3Row Labels9/5/20209/12/20209/19/20209/26/202010/3/202010/3/202010/10/202010/17/202010/24/2020
4DINGARI, HRUSHIKESH K403240402717958160323.391303.331844.722023.72
5NAIR, GIRISH27271840203.39783.331044.721071.72
6SARKAR, ASHIS40324040152404040440560712
7(blank)808080240240
8FAHEEM, WAEL72324016503091202864704042.54918.55227.5
9AGARWAL, DINESH32324040801012.51172.51204.5
10CHANDRASEKHARAN, RAJEEV4032401250237802463502461.53137.53374.5
11CHANG, SOK WU W505050
12WHITE, CHRIS L404040420.5460.5500.5
13(blank)989898
14GERMANOTTA, DOMINIC402004962856.253592.253592.25
15BONOMO, MICHAEL404081931.751092.751092.75
16HALL, TAMARA L160160160
17RANGARAJAN, JAGANNATH K160415117617511751
18STRATFORD, CHRIS547.5547.5547.5
19STRATTON, LAURA M414141
20GURUMURTHY, VIVEK180157237365.5431.5137135811303732.9710694.8315915.817286.8
21BASU, SANJAY43.5415.33458.83458.83
22BELIHOMJI, ADIL140125170257.5246.5939201711.5192358438678.59617.5
23JAIN, ARCHANA4067681853601173241566.473700.55707.976067.97
24NIRANJANI, HIMANSHU32407240402007009801052
25SUDHARSAN, VELAMUR S54.53690.590.5
26MADERA, ISAAC A743285852730358181576.983234.054050.034353.03
27BAESSLER, CHRISTINA74328585273035885408.981393.551945.532248.53
28CASO, ANDREW T767676
29GREGORY, LISA M96144469709709
30JOBERT, SEBASTIEN595595595
31KERCHER, TODD E404040
32PAONE, KELLY M246246246
33REPER, LAURA L24334.5358.5358.5
34VENKATRAMAN, SRINIVAS808080
35RAMANATHAN, SANKARAN4021891111691169
36DAMIANO, NATALIE M291.5291.5291.5
37JOSHI, ANIRUDHA A129170299299
38RAY, ANDREW L4089369.5498.5498.5
39(blank)808080
40SINGH, SUMIT4848321632431812.252250.252298.25
41FUJINAMI, GARY G183183183
42KRIER, RYAN210.5210.5210.5
43PAFF, MARK D808080
44SCHANEL, BARBARA J40484524524
45SHARMA, RAJU707070
46TANUKU, NAGESWARA RAO484832163203454852900
47(blank)330.75330.75330.75
48SIVAGANESH, SIVAGNANALINGAM423423423
49KAUL, ASHUMA S120120120
50MYLAVARUPU, VENKAT S183183183
51THAKER, DHAVAL V808080
52(blank)404040
53SLY, DAVID G4444851523.51608.51652.5
54BARNAK, ROBERT W44448080124
55BILLINGER-JONES, ANTOINETTE M40281321321
56FONTANA, OTTAVIO S45282327327
57HAVEWALA, ASPI191.5191.5191.5
58MATEO, ALFRED A523523523
59(blank)166166166
60ZIAEE, KAMRAN80142389.5507257.513762615745492539.53923.55299.5
61CHAKRAVARTY, SHOMA655655655
62KUMAR, NANDA78309.5427257.51072165417.5390.5126222353307
63PASTOR, RICHARD515151
64SEKAR, KALYANI392392392
65(blank)8064808030496156.5158.5179.5590.5894.5
66Grand Total446395791.51206.5791363092727346694.3429340.2139695.5543325.55
Pivot



below is what my output sheet looks like.

Overall Shankar_Cox_UnapprovedTime.xlsm
ABJKL
1
2YTD to OCT 10YTD to OCT 17YTD to OCT 24
3
4GERMANOTTA, DOMINIC7747.333204.5
5BONOMO, MICHAEL1697829.5
6HALL, TAMARA L1306.33295.5
7PRADHAN, JEETENDRA 1243.5279
8RANGARAJAN, JAGANNATH K2760.51675.5
9STRATFORD, CHRIS74085
10STRATTON, LAURA MNA40
11((blank)NANA
12DINGARI, HRUSHIKESH K69553494
13NAIR, GIRISH2141.52829.5
14SARKAR, ASHIS1842584.5
15VENKATRAMAN, SRINIVAS 1654NA
16HUGHES, GEORGE L 246NA
17THAKER, DHAVAL V942.5
18(blank)12980
19FAHEEM, WAEL6901.435039.5
20AGARWAL, DINESH28031670.5
21CHANDRASEKHARAN, RAJEEV2876.342740
22CHANG, SOK WU W4040
23ZAVAR, MASTANEH 228NA
24WHITE, CHRIS L902.09589
25(blank)52NA
26GURUMURTHY, VIVEK24709.6120295
27BASU, SANJAY838.25780.58
28BELIHOMJI, ADIL12993.4412266.5
29JAIN, ARCHANA8242.425193.17
30SUDHARSAN, VELAMUR S428.5450.5
31NIRANJANI, HIMANSHU22071604.25
32(blank)NANA
33MADERA, ISAAC A5674.683484.94
34BAESSLER, CHRISTINA2199.681883.94
35CASO, ANDREW T34040
36GREGORY, LISA M290734
37JOBERT, SEBASTIEN1363170
38REPER, LAURA L71664
39PAONE, KELLY M216421
40KERCHER, TODD E29440
41VENKATRAMAN, SRINIVASNANA
42(blank)256132
43MUSE, ERIC V1200
44BOWEN, TROY L 120NA
45PETTIT, STEPHENNANA
46SANKARANARAYANAN, RAMESHNANA
47TOTH, RICHARD A NANA
48(blank)NANA
49RAMANATHAN, SANKARAN3078.671902.16
50DAMIANO, NATALIE M583.17NA
51MYLAVARUPU, VENKAT S1562
52RAY, ANDREW L813.5602.66
53KUSHWAHA, ABHITABHNANA
54JOSHI, ANIRUDHA A1139.5
55(blank)120160
56SINGH, SUMIT5155.41762.33
57FUJINAMI, GARY G552174
58KRIER, RYAN394.4120
59PAFF, MARK D966.5120
60SCHANEL, BARBARA J56132
61TANUKU, NAGESWARA RAO1266.5821
62KIRKWOOD, SARA M 397NA
63SHARMA, RAJUNANA
64(blank)1018495.33
65SLY, DAVID G5230.751414.73
66BARNAK, ROBERT W83644
67BILLINGER-JONES, ANTOINETTE M1054.540
68FONTANA, OTTAVIO S431787
69HAVEWALA, ASPI1001.5120
70MATEO, ALFRED A1711.25383.73
71(blank)196.540
72ZIAEE, KAMRAN6,160.425,639.83
73CHAKRAVARTY, SHOMA422340
74KUMAR, NANDA29053259.5
75MONDRY, MARC WNANA
76PASTOR, RICHARD1258.42252.83
77SEKAR, KALYANI618.5672.5
78(blank)956.51115
79SIVAGANESH, SIVAGNANALINGAM610365
80JOSHI, ANIRUDHA A445
81KAUL, ASHUMA S125205
82SHARMA, RAJU40NA
83THAKER, DHAVAL V120
84MYLAVARUPU, VENKAT S40
85(blank)NANA
86Grand Total72343.2946601.99
View 1 Week on Week Trend - Un


below are the steps that needs to be done.

1. code has to as user for a date for which he needs data (In this case let us say 10/24/2020)
2. now it has to pull the values from pivot based on the date user provided and out put should be placed in the output sheet (it has to enter the values in first empty colum - in this case that is column "L"). Data needs to be pulled for both Senior manager and manager.
3. before pulling the data from pivot table code has to check if there are changes in terms of senior managers or managers with the output sheet. if there are any removal we can ignore but if there is a addition of manager under a senior manager then a new row needs to included under that particular senior manager in the output sheet and newly added manager name to be added in "B' Column of newly added row and his data needs to be pulled from pivot.
4. let us say we have a case where new senior manager is added then it has to add a row and respective name has to be entered in to "A" column of newly added row and data needs to be pulled from pivot.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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