Hide/Show Pivot Table Data Based On Criteria
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
ADVERTISEMENT
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
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
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
View Related
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
Mar 8, 2014
I have a very large table and i need to be able to Hide/show specific ranges based on:
Filter +and+ specific cell values in columns
brief example of the table : tablee.png
So...
1. Filter Column "B" (in this case we select "HELPING")
2. Auto hide/show collumns. - IF "C1" = "Required" THAN Show "C:E", IF "C1" ="N/A" , HIDE "C:E" and so on for every column like above.
There are over 80 columns like the "C:E" range. and I only need to show those that are "Required".
View 1 Replies
View Related
Jan 22, 2008
I have a list of Insurance payers - 20 or so. They are listed in a Pivot Table on sheet2 with rate data and such. On sheet1 I have a listbox with the Payers listed and can be multi selected by the user. I wish to have the user select some payers in the listbox, goto sheet2 and view the Pivot Table only containing those Payers selected from the listbox.
View 4 Replies
View Related
Jan 27, 2014
filter my pivot table using a cell value, rather than manually selecting from the dropdown.
The report filter title is Rnd H, and values start from 0 through to 2, at .1 intervals (so 0.1, 0.2, 0.3, 0.4 etc).
Rather than select "0.3" manually from the dropdown, can the pivot table do this if "0.3" was written in cell A1 for instance?
View 5 Replies
View Related
May 19, 2008
I have used a pivot table with help from members here for a rota.
Now i am wondering if i can add a column to the original data which is hidden to times the number of hours worked by the hourly rate which is in another sheet.
The pivot table will be in an admin sheet with protected access so employees cant see it.
View 9 Replies
View Related
Aug 21, 2012
I'm trying to make a pivot table that can compare sales based on the whatever month/year/salesman combination I give.
Ideally, I'll be comparing the sales data for 3 seperate months. Can I make a pivot table where I can make different filters apply to specific columns?
View 1 Replies
View Related
Sep 7, 2006
I am using pivot table for my customer aging which a sample is enclose. What I want to do is to Highlight the field " Customer Name " in colour if the the Field " Type of guarantee" is other than 0. Also a message of " Credit limit Exceeded" if the outstanding is more than the Credit limit.
View 2 Replies
View Related
Apr 10, 2008
My goal is for any of my team members to be able to use a macro to delete all of the unwanted text from a fairly large worksheet and only show their specific information. I created it for myself and posted a slimmed down version of it below. Instead of the macro deleting any rows that do not have BRANDON SCOTT in column D, I want a pop up box to enter your name, and then any rows that do not have your name in column D will be deleted. I’m sure it is something simple, but I have not been able to find another forum with this information.
Sub MyTeam2()
With Columns("D")
. AutoFilter field:=1, Criteria1:="<>BRANDON SCOTT*"
.Resize(Rows.Count - 1).Offset(1).EntireRow.Delete
.AutoFilter
End With
End Sub
View 3 Replies
View Related
Feb 12, 2014
STO-Productivity-Feb0314.xlsxI work in cancer research and I'm trying to find a way to show the amount of studies that staff have in total and their role on the study. I have a data table that contains many fields but the crux of what I'm having trouble with starts with the following:
When I begin with a pivot table I start by just selecting the all of the studies listed in the table and then the two roles that staff can have data or regulatory. Staff can do both roles or just one on a study. I put the roles of data and regulatory into the row labels and the studies that we work on in the values. The problem is that I now only see studies that the staff member works on that meet working on both roles and not the studies that they serve only one role.
UPDATE: see the attached spreadsheet to illustrate further. Ablorh is the employee that I have it focused on and it only shows the one study she has both the regulator and data roles. The 7 other studies that the employee works on in the data role do not show.
View 2 Replies
View Related
Nov 4, 2009
Does any one know how I can resolve the calculation error that shows up in a pivot table when you select "show data as a running total in" option and you end up with a very small difference error.
In other words if I add 12.96 + 2.04 + (-15) and you get 1.455E-11 instead of zero. When these calculation errors show up in normal spreadsheet calculations outside of pivot table you can always use the ROUND function to correct these arbitrary calculation errors.
I'm looking for a recommendion for handling this in a pivot table where I have a couple of hundred columns of data that are using the "running total in" option.
View 9 Replies
View Related
May 16, 2013
I have a data set that I constantly run a pivot table. I have the pivot table run on a separate sheet each time. Since I run it every time I was wondering if there is a way to set up a pivot table to run automatically and run it on a separate sheet.
Lastly, if that is possible, if the data set changes and the pivot table runs automatically will the pivot table recalculate based on the new data.
View 9 Replies
View Related
Mar 4, 2014
I'm looking to update a pivot table based on some info in a cell but I keep getting an error message.
View 7 Replies
View Related
Mar 19, 2013
On a worksheet, I created:
- a list of data
- a pivottable based on these data
When moving this worksheet this worksheet to another workbook, the pivot table can't refresh anymore. This throws an error message "Reference is not valid". To work around this problem I need to adapt the datasource. The same occurs if the list and the pivot table are on separate sheet, with the added strange behaviour that, when data an PT are split, it is not possible to move both sheet together.
This would not be a big issue if my problem had to be solved manually. The real problem is that I need to move the sheets from a C# program.
View 3 Replies
View Related
Feb 14, 2013
I found this code and am trying to use it to update the filter in my pivot table (sheet 6), based on the data validation selection in sheet 1, but when I make my selection on sheet 1, nothing happens.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim pt As PivotTable
Dim pi As PivotItem
Dim strField As String
strField = "Region"
[code]....
View 3 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
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
Feb 21, 2008
One problem I am however having is with a spreadsheet similar to this example found on another site. On the pivot table sheet. The link is http://www.kan.org/tips/files/sumproduct_advanced1.xls
The problem Im having is, for a particular number that is column D I want to hide what is column A. For example for every number "0" that is found in column D, I want to hide its heading in column A along with the rest of the numbers that are in column D that are associated with the heading as well.
View 2 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
Jul 7, 2014
I've been trying to get a table to populate based on a couple of criteria. However, I've not come-up with the solution yet.
I have my dropdown selections in cells C2 & C3. The objective is to populate the table below the dropdown with data from the sheet named (very unimaginatively) 'Data'. Currently you see the selection AA-11 & Mar-14 in the Contract ID & Month cells. If I change this, the table below should auto-populate.
I've attempted using Vlookup, Index-Match. But it does not give me the desired result.
Also, the number of Products can change each month (although the file shows 4 for each month & each Account).
View 4 Replies
View Related
Feb 20, 2010
I'm using pivot table and i want to erase the blank cell that come out with pivot table and replace it with number 0 or -, how can i do that ? i've be try to do this by go to the table option and in the empty cells check list i've put 0 or - but the pivot table still come out "blank".
View 8 Replies
View Related
Feb 8, 2014
I have a report that has percentage of row totals that just displays as 100% for the grand total column. I want to hide that percentage of row column. I've attached the excel file below to see the pivot tables.
detail report.zip‎
View 3 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
Mar 5, 2013
I have the following code to update a pivot table:
Code:
Dim pt As PivotTable
Application.EnableCancelKey = xlDisabled
For Each pt In ActiveWorkbook.Worksheets("sheet1").PivotTables
pt.ChangePivotCache ActiveWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:="source!R4C1:R33443C55" _
, Version:=xlPivotTableVersion10)
Next pt
the R33443 term is what will be changing, the columns and the starting row should stay the same. is there a way to instead of using R33443, to enable the range to be changed based on a cell value?
View 2 Replies
View Related