Create Pivot Table By Tab

freddyboots

New Member
Joined
Jul 24, 2021
Messages
5
Office Version
  1. 2016
  2. 2013
Hi.

Via VBA code, I would like to create a pivot table by tab for each change in Rep name. So in the example attached there would be 3 tabs created using classic Pivot tables from the Raw Data. The ADB field should be subtotaled by Dealer Code as listed in the second attachment.


RAW DATA

Rep ADB.xlsx
ABCDEFG
1Rep NameDealer CodeDealer NameBranch CodeFund CodeFund NameADB
2Johnson000123ABC Corp2YR9998Fund Name 11,000,000.00
3Johnson000123ABC Corp3YR9997Fund Name 162,000,000.00
4Johnson000123ABC Corp3YZ9997Fund Name 16(500,000.00)
5Johnson000124DEF CorpDIV9989Fund Name 23,000,000.00
6Johnson000125GHI Corp000000048222Fund Name 34,000,000.00
7Johnson000126JKL Corp46031217Fund Name 45,000,000.00
8Jones000123ABC Corp2YR9998Fund Name 1100,000.00
9Jones000123ABC Corp3YR9997Fund Name 16200,000.00
10Jones000124DEF CorpDIV9989Fund Name 2300,000.00
11Jones000125GHI Corp000000048222Fund Name 3400,000.00
12Jones000126JKL Corp46031217Fund Name 4500,000.00
13Smith000123ABC Corp2YR9998Fund Name 110,000.00
14Smith000123ABC Corp3YR9997Fund Name 1620,000.00
15Smith000124DEF CorpDIV9989Fund Name 230,000.00
16Smith000125GHI Corp000000048222Fund Name 340,000.00
17Smith000126JKL Corp46031217Fund Name 450,000.00
Data


EXPECTED RESULTS OF ONE PIVOT TABLE

Rep ADB.xlsx
ABCDEFG
1
2
3Sum of ADB
4Rep NameDealer CodeDealer NameBranch CodeFund CodeFund NameTotal
5Johnson000123ABC Corp2YR9998Fund Name 11,000,000.00
63YR9997Fund Name 162,000,000.00
73YZ9997Fund Name 16(500,000.00)
8000123 Total2,500,000.00
9000124DEF CorpDIV9989Fund Name 23,000,000.00
10000124 Total3,000,000.00
11000125GHI Corp000000048222Fund Name 34,000,000.00
12000125 Total4,000,000.00
13000126JKL Corp46031217Fund Name 45,000,000.00
14000126 Total5,000,000.00
15Johnson Total14,500,000.00
16Grand Total14,500,000.00
Johnson
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Also you do know that pivot tables can be exploded to do exactly what you want right ?
The only difference is that the name will be in the Page Filter header instead of in the Pivot table body.

Steps:
  • Pull Rep Name into the filter section
  • PivotTable Analyze > Pivot Table (far left) > Options > Show Report Pages
If you want to convert it into a macro just record it when you do it.

Warning: Each pivot table will have "all" the data sitting under it. So don't give it to someone as a pivot table thinking they will be restricted to just seeing their own data.
You would need to convert the pivot to being just values if you want to restrict their viewing access.

1627619947881.png
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

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