Pivot table question

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I thought this would be a pretty simple process but alas... I would like to work out how may staff are under 50 per dept, I'd usually do this through a value filter which in this case is not available via the menu for Age (because it is number data type?). Is there a workaround or does the data require some preparation for this to work?

Book7
ABCDEF
1NameDeptAge
2JimHR62
3HarrySales31Row LabelsCount of Age
4BertAdmin25Admin2
5TomHR33HR3
6HelenSales54Sales3
7KateAdmin31Grand Total8
8NoelHR49
9SteveSales32
Sheet1
 
Thanks Peter, your macro works well. I guess there's no non-VBA way to do this?
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I guess there's no non-VBA way to do this?
Not if you want to continue using the Pivot Table.

If you abandon the Pivot Table for this and use Excel 365 with the new dynamic array functions then you just need these 2 formulas in E2 & F2 and the other results should 'spill' down.

Tigerexcel 1.xlsm
ABCDEFG
1NameDeptAgeDeptAge less than:35
2JimHR62Admin2
3HarrySales31HR1
4BertAdmin25Sales2
5TomHR33
6HelenSales54
7KateAdmin31
8NoelHR49
9SteveSales32
10
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=SORT(UNIQUE(FILTER(B2:B20,B2:B20<>"")))
F2:F4F2=COUNTIFS(B2:B20,E2#,C2:C20,"<"&G$1)
Dynamic array formulas.



If you want/need it to work in both 365 and 2019 then copy these down as far as you might ever need.

Tigerexcel 1.xlsm
ABCDEFG
1NameDeptAgeDeptAge less than:35
2JimHR62HR1
3HarrySales31Sales2
4BertAdmin25Admin2
5TomHR33  
6HelenSales54  
7KateAdmin31  
8NoelHR49  
9SteveSales32  
10  
Sheet3
Cell Formulas
RangeFormula
E2:E10E2=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW(B$2:B$20)/(ISNA(MATCH(B$2:B$20,E$1:E1,0))*(B$2:B$20<>"")),1)),"")
F2:F10F2=IF(E2="","",COUNTIFS(B$2:B$20,E2,C$2:C$20,"<"&G$1))
 
Upvote 0
Thanks Peter I like that formula.

I actually like using PTs, I was wondering whether there was a method within the PT settings that would allow you to collapse the detail and just show the totals as the number of columns gets large when you add the field to the column label.
 
Upvote 0
Nothing that would work very well for what you are trying to do as far as I know (though Pivot Tables are not a particular strength of mine)
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,269
Members
449,219
Latest member
daynle

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