Easily Hide/Show Pivot Table Items
Apr 5, 2008
I work at a trading firm and use pivot tables to report on the success of traders on a daily basis. I add daily trading data to a raw data table that powers a set of reports. In one report I want to view MTD stats for a filtered group of 10 traders. The issue is that if I add a set of daily data that includes a new trader name, it will automatically be pre-checked and added to this report (and this happens daily). The only solution I came up with is to add another column in the raw data table that would allow me to group these traders and then use a page filter to include only them. This will work but I'd rather avoid adding columns to an already unruly data table (and would like flexibility to periodically define and track an arbitrary set of traders).
View 4 Replies
ADVERTISEMENT
Nov 8, 2006
I have a pivot table with the column fields as dates. I will like to be able to use VB to dictate which value to show. Here is brief code in which I just recorded...
Sub Button1_Click()
Range("B7").Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Date")
.PivotItems("10/30/2006").Visible = False
.PivotItems("10/31/2006").Visible = True
End With
End Sub
I would like to show current day only using =today() or something similar. THis would eliminate the user having to modify the pivot tables daily.
View 5 Replies
View Related
Nov 29, 2011
Is there a way to have a Pivot Table show only the Top 10 items based on dollar amount. Data covers a month of daily activity (+/- 250 rows), but i only want the Top 10 items based on Dollar amount. Is this possible?
I know filters can do top 10 but it doesn't consolidate similar items.
View 5 Replies
View Related
Nov 24, 2009
I copied and modified the pivottable code from http://www.ozgrid.com/VBA/hide-pivot-fields.htm. I am getting a "Run time 13" error on the line I colored purple. I tried removing different "Dim" statements to make it work and I'm having no luck.
Sub PickUpPivotTable()
Dim pt As PivotTable, pi As PivotItem
Dim lType As Long, lHarn As Long
Dim strCri As String, strCri1 As String, strCri2 As String
Dim bHide As Boolean
Dim xlCalc As XlCalculation
Set pt = Worksheets("Monthly Pivot Summary").PivotTables("MonthlyPivotSummary")
strCri = "P/U"
For Each pi In pt.PivotFields("Type").PivotItems
lType = pi..........................
View 6 Replies
View Related
Oct 10, 2007
Im using the following VBA code, but the on error resume does nothing, excel throws out the error 1004 "Unable to get the pivotfields property of the pivottable class" (i know why the error is caused and how to fix it but my error trapping wont work). Is there some option which i have turned off which prevents me from trapping errors?
Dim ws As Worksheet
Set ws = Excel.Sheets("Sheet1")
On Error Goto err:
If ws. Range("IV1").Value = "dog" Then
ws.PivotTables("PivotTable1").PivotFields("Price Euros").Orientation = xlHidden
Else
ws.PivotTables("PivotTable1").PivotFields("Price Dollars").Orientation = xlHidden
End If
err:
msgbox "invalid"
View 5 Replies
View Related
Feb 24, 2008
I'm just stuck on a final thing......I would like the pivot table to collapse based on the outcome of a formula. For instance I've got a project that has A, B, C, D as component parts, these parts all have a percentage work completed. If let's say A is a 100% complete I would like to automatically collapse A, so it will just show the summary for A. Obviously this can be done by hand, but since there is quite a lot of data I would like to automate the proces.
View 8 Replies
View Related
Dec 12, 2007
I want to write a VBA code, so I can apply dates criterias to my pivot table. Say, I have 1-Dec-2007 in "C2" and 10-Dec-2007 in "C3". Now I want my pivot table to show me the dates between those two dates and the data that goes along with it. I have written this code, but it keep debugging:
Sub FilterDates()
Application. ScreenUpdating = False
Sheets("PnL").Select
Sheets("PnL").PivotTables("PivotTable3").PivotFields("Date") _
.PivotItems("01/01/1950").Visible = True 'to always have 1 populated
View 9 Replies
View Related
Feb 22, 2008
I have looked at the below Hide/Show Pivot Table Field Items help web pages:
Hide/Show Pivot Table Field Items
Hide Pivot Table Fields Pivot Items by Criteria
I am trying to use the above, but with dates in the following format in each cell:
YYYYMM
200612
200701
200702
200703
200704
200705
200706
etc, etc
The below code is working for >200702 and removes all years/months prior to this entered value. Unfortunately the code does not work when a user enters <200706, instead the code goes through to the “NonValidCriteria” prompt.
Sub HideByCriteriaYYYYMM()
'Declare variables
'SEE: [url]
'SEE: [url]
Dim pt As PivotTable, pi As PivotItem
Dim lMonth As Long
Dim strCri As String, strCri1 As String, strCri2 As String
Dim bHide As Boolean
Dim xlCalc As XlCalculation
View 4 Replies
View Related
Jun 19, 2008
I've got 4 pivot tables (all derived from the same base data) on 4 separate worksheets. I've been able to (with this help of this site) to use VBA to hide pivot items on all of these sheets using a list on a user form. Hide/Show Pivot Table Field Items. Hide Pivot Table Fields Pivot Items by Criteria
I now need to be able to show all the pivot items on only 3 of the 4 pivot tables, with the 4th pivot table being left untouched. For ease assume that my sheets are sheet1, sheet2, sheet3, and sheet4. The tables I wish to update are on sheet2, sheet3 and sheet4. The pivot table on each sheet is called "PivotTable4" and the pivot item is called "Business". The pivot item contains 12 business names (Business1, Business2 etc etc)
Is there an easy way of doing this? I've spent the day looking through the internet and various "Dummies" books but with little success, I fear that I'm obviously below even Dummy level
View 5 Replies
View Related
Jul 25, 2008
I have a database table with selling prices. I want to get a count of number of customers by sales price range.
For example:
Price Count
$0-$5 #
$5-$10 #
$10-$15 #
Total
My nose says this is what a pivot table should do but there are too many sales prices and the pivot table craps out. How do I get them into ranges as above and then count them?
View 9 Replies
View Related
Oct 26, 2013
I've created a PivotTable using VBA that contains hundreds of PivotItems, which would look bad when a PivotChart is made.
I'd like to set the PivotTable to make visible only the first X items (let's say 10). How would I do this in VBA?The macro recorder gives me the name of the PivotItem, but this varies so I'd like to use an index:
VB:
ActiveSheet.PivotTables("PivotTable4").PivotFields("UWI").PivotItems("Item1").Visible = False
ActiveSheet.PivotTables("PivotTable4").PivotFields("UWI").PivotItems("Item2").Visible = False
View 2 Replies
View Related
Jun 4, 2014
See attached.
Basically, I just want to do a pivot which shows the Name and Number for those names listed in the LIST tab.
The pivot source is the data tab, and the result is in the result tab.
I have the code to create the pivot, but filtering it for those specific names on the LIST tab is where I am getting stuck.
Attached File : Excel VBA Pivot Problem.xlsx‎
View 1 Replies
View Related
May 24, 2012
I've created a pivot table that is not grouping "like" items. I have verified all fields are numbers using the =isnumber() formula. All items present with the "true" value. Just in case, I tried doing text to columns and refreshing the data but that did not work either. All items are formatted the same. All data fields have values.
View 1 Replies
View Related
Aug 22, 2014
I have to check if two items are in column A, and if yes, there values from column B shoulded be summed. I tried different combinations with IF, LOOKUP but didn't go far.
View 2 Replies
View Related
Mar 21, 2012
I am trying to use the bellow code to set one pivot item (MyItem) to true and the rest to false... unsuccesfully
Code:
For Each pt In Sheets("Schedule Dashboard").PivotTables(PivotTable1)
If pt.PivotFields("District").PivotItems(MyItem).Visible = False Then
pt.PivotFields("District").PivotItems(MyItem).Visible = True
Else
pt.PivotFields("District").PivotItems.Visible = False
End If
Next pt
View 9 Replies
View Related
Jun 21, 2012
I'm trying to write a macro to select the multiple sets of the same data for several PIVOT tables. I've tried Slicers but it seems that this takes up too much processing power and always times out.
My workaround is to do a macro that picks out the said data, however when i do the below, plus another 4-500 lines i get told that there are too many line continuations
Code:
ActiveSheet.PivotTables("PivotTable6").PivotFields( _
"[Postal District].[Postal District].[Postal District]").VisibleItemsList = _
Array("[Postal District].[Postal District].&[AB11]", _
"[Postal District].[Postal District].&[AB12]", _
[Code] ...
What I'm looking to do is express all the postcodes in one line or at least multiple post codes in one go, this is what I've tried:
Code:
"[Postal District].[Postal District].&[AB12].&[AB13]"
and
Code:
"[Postal District].[Postal District].&[AB12,AB13]"
But to no avail.
View 4 Replies
View Related
Apr 1, 2008
I have a Pivot Table on which I am unable to drag the row items (Salesperson Names) to a different position. What am I doing wrong? Attached Sample
View 9 Replies
View Related
Dec 30, 2009
I am looking for a way in VB to select and unselect items in the list for filters generated in a pivot table.item list. Ho do I do that?
View 5 Replies
View Related
Feb 20, 2012
I am looking for a way to extract all of the unique items in a Pivot Table. For example, I have a Pivot Table that has category A items and category B items. There may be several B items to one A. For example:
A0
B1
B2
B3A1
B3
B4
B5
Now, what I need is a list that looks like this:
A0 - B1
A0 - B2
A0 - B3
A1 - B3
A1 - B4
A1 - B5
Formatted so that those are two columns. However, in Excel 2007, I cannot set the option to have it repeat the A series items in the Pivot table. Is there some easier way to do this?
View 2 Replies
View Related
Oct 15, 2012
I'm trying to count how many production orders i have per week. However, there are duplicated production orders per week. I only want to count how many unique orders there are for each week. I only see the ability to "Count", which counts my duplicates as well so it over inflates my true quantity.
View 3 Replies
View Related
Nov 11, 2013
I have a pivot table with the following items;
Report Filter = Project Names & Dates (filtered on 2 fields)
then the pivot table of data shows
Dept, Sum of Hours, Sum of Total ($), Sum of Days
When you click on the drop down to adjust the filter for the Date it gives you the whole list of dates, day by day as it is in the source data.
Is there a way to make it in the filter by month and year, the way it would in an ordinary filter. So if I wanted to have the pivot table show only the values with an October date I can, rather than having to deselect all and then individually check the boxes for the 1st through to the 31st of October.?
View 2 Replies
View Related
Jan 22, 2009
I am trying to form a macro in VBA that will basically uncheck the "Show All" function of the Pivot Table filter user interface, and then select only the one PivotItem that I want. In context, I have about 50+ different project numbers, each with a different worksheet and its corresponding pivot table. Here is what I have so far:
Dim pvtitem
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Project #")
For Each pvtitem In .PivotItems
pvtitem.Visible = False
Next
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Project #")
.PivotItems("525064").Visible = True
End With
When I try to run it, it gives me the error: "Unable to set the Visible property of the PivotItem class". It looks like the error occurs in the loop part of the macro.
View 9 Replies
View Related
Jun 19, 2013
I'm trying to use a List Box to select multiple items on my Pivot Table but I can't seem to get it to work. Its the Report Filter part of the pivot table.
When the list Box is set to fmMultiSelectSingle it work and selects the indivdual items, but I need it set as fmMultiSelectMulti for if i'm also needed to select multiple items. (which doesn't seem to work!)
View 2 Replies
View Related
Apr 1, 2014
Using Excel 2013,
I clicked on a field in my RowLabels
I then clicked on the Filter Arrow for the RowField
The SelectedField prompted with the correct field of 4 possible fields
However the item I am looking for is not in the list but I can plainly see it on the screen.
View 3 Replies
View Related
Oct 27, 2011
I am trying to automate the creation of 3 pivot tables. At first I was having a problem with deselecting all items in the drop-down except one, then I found the code to fix it.
I replaced this code:
ActiveSheet.PivotTables("PivotTable15").PivotFields( _
"Beta")
.PivotItems("Escalated").Visible = False
.PivotItems("Hang Up").Visible = False
.PivotItems("New Hire Requests").Visible = False
.PivotItems("No Trouble Found").Visible = False
.PivotItems("Priority Exchange").Visible = False
[code].....
This fixed the problem, but there are still two other pivot tables that need to be created after this first one. I scrolled down through the code and deleted the other code blocks for the selection of the PivotItems and replaced it with the code above, but then when I ran it I got the "Compile Error: Duplicate Declaration in current scope".
I read more through the forum and realize that it's because VBA is dimensioning it twice, and I read that you're supposed to Dimension at the beginning of your program, but how do I implement this into my coding?
I can't dimension literally at the start of the code, there is some formatting that needs to take place first. (Basically I paste in a bunch of data into Sheet1 of my workbook, center it, space it out, then insert a pivot table into the pre-existing Sheet2 based on that data, filtered on the blank entries in Column N. Then I need to create ANOTHER pivot table based on that same data in Sheet1, but filtered on the blank entries in Column O. Then I center the words in the Pivot tables' headers in Sheet2, and finally I need to create one last pivot table on pre-existing Sheet3 based on the data on Sheet1, filtered for 2 specific entry types in Column N.)
View 2 Replies
View Related
Dec 22, 2011
In the coming months the company i work for will be transferring from Excel 2003 to Excel 2010 (i know, a little late......) and now i am testing some things at home.
We deliver lots of Excel reports to our clients where we are using Pivot tables. In excel 2003 we where able to hide items from the dropdowns using properties - hide items but when i now open an excel 2003 file in excel 2010 and want to filter the pivot table to (let's say) another month i see all my hidden items.
Is there an option in excel 2010 to hide items like i could do in 2003? (either regular option or VBA)
View 4 Replies
View Related
Oct 26, 2006
Is it possible to get the current Page Item Selected for a pivot table
I've tried the following functions in VBA, but have had no success
CurrentPageName
CurrentPage
CurrentPageItem
ParentItems
View 9 Replies
View Related
Sep 26, 2007
Sub Hidesingles()
For i = 5 To ActiveSheet.UsedRange.Rows.Count
For c = 3 To ActiveSheet.UsedRange.Column.Count
If Cells(i, c) .........
View 9 Replies
View Related
May 31, 2007
I've got a database view that holds data for over a year, i use a - 2 day rule to show net data, for example
todays date is the 31th 5 2007 if i show data up untill today it will be gross data, so i use the -2day rile to show the net data,
the way i do this is in a pivot table i hide the last 2 date.
I have a DTS package the refreshed the Pivot table but i'd like also to have a macro or maybe vba script to ide the
2 last days this will have to happen every day so for to day it will hide the 30th and 29 tomorrow it will show
the 29th and hide the 30 & 31th. I still need to have the data for the 30th & 31 in the drilldown as some people work with
the gross data so i can't just make the change inthe database i wish it was that easy. At the moment i go in to the
pivot table and Highligh the last 2 days. i'd like a way of doing this automically.
View 5 Replies
View Related
Jul 13, 2007
I have a pivot table with many columns... I'm trying to see if there is way for a pivot table not to show any fields with a value of "0"...
View 6 Replies
View Related