Switch between different PivotTable Fields for Values

EdwardJ02

New Member
Joined
Mar 19, 2024
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have an excel file where employees can submit projects they are working on and amount spent on the project each month. The names of the months are therefore in the columns as headers. When I make a PivotTable out of the table I have the persons in the Row sections and the month I want to see in the Values section of the PivotTable. Looks like this.
1710854206649.png
1710854221025.png


I can create a Slicer for the persons if I want to filter between different people. But because each month is it's own PivotTable Field I cannot create a slicer for the months.

Is there I way I can create something that mimics the function of a Slicer so I can easily switch between the months without manually unchecking the month selected and selecting the next month in the PivotTable.

Thank you in advance and let me know if there is more information you need from me! :)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
So I found this video as a solution to my problem.
.

I used the VBA code from the video and adding this string to add the PivotTable Field again, so it works like a loop. So in total I had to create 12 macros, one for each month. And it works in a chronological order, so after January you have to click the macro for February, otherwise the order gets messed up.
VBA Code:
ActiveSheet.PivotTables("PivotTable7").AddDataField ActiveSheet.PivotTables( _
        "PivotTable7").PivotFields("November"), "Sum of November", xlSum

Maybe someone got a better solution. But now I can flip through the month and see how much each employee spent on projects that month.
 
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,612
Members
452,661
Latest member
Nonhle

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