Filter Pivot Table From List

kdickey

New Member
Joined
Jun 25, 2015
Messages
2
I have created a PowerPivot Table in Excel 2013 which extracts data every 24 hrs from a company database. Unfortunately, the data I extract contains information for the entire company and I only need information for about 90 employees.

I have created a PivotTable named "User_Report" on a worksheet called "User_Chart". I want to filter out employee names in the Pivot Table which are located in an Active Field named "User_Name". On a separate spreadsheet, I have a list of employees located in a Table called "User_Table" which is on a worksheet called "Sales_Roster_Filter".

I have created a Command Button with a VBA to filter the Pivot Table with the list of employees I need with the following code:



Sub Test()
Dim PI As PivotItem
With Worksheets("User_Chart").PivotTables("User_Report").PivotFields("User_Name")
.ClearAllFilters
For Each PI In .PivotItems
PI.Visible = WorksheetFunction.CountIf(Range("User_Table"), PI.Name) > 0
Next PI
End With
End Sub



Unfortunately, this code does not appear to do anything. If anyone has any suggestions, it would be much appreciated, I would prefer not having to manually select the names I need from a list of thousands. If I can clarify my issue further, please let me know. Thanks.



*****Please Note: The spelling of the employee names in the PivotTable (the names pulled from the database) is not an exact match with the spelling of the names in the table I created, but is accurate enough that an approximate match should work*****
 
Last edited:

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

kdickey

New Member
Joined
Jun 25, 2015
Messages
2
I need to turn this report in today so please help if you can! Thank you!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,478
Messages
5,601,900
Members
414,482
Latest member
morkar

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
Top