#1
|
|||
|
|||
CountIF Functions
I have countIF Functions in my spreadsheet for Customer, Industry and Level. My countif functions are on a worksheet and updating every time I add to the worksheet. Is there a way with countif to drill down to the Customers who fall under that Industry. I know I can use a pivot table to calculate total and drill down, but I do not want to remember to have to refresh every time the data updates. I am not the only ones using the report.
|
#2
|
||||
|
||||
You can add a little macro like this via the Worksheet_activate event
Code:
Sub PivotMacro() Dim pt As PivotTable Set pt = ActiveSheet.PivotTables("MyPivot") pt.RefreshTable End Sub Also see that your data source is dynamic ( like a table)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#3
|
|||
|
|||
Thank you. Does that command automatically update the worksheet. Do I add the code by clicking on the worksheet and view code and just past it in.
Sub PivotMacro()Dim pt As PivotTableSet pt = ActiveSheet.PivotTables("MyPivot")pt.RefreshTableEnd Sub Also I am using the offset function for the dynamic data but it does not seem to be working. =OFFSET(Inventory!$A$1,0,0,COUNTA(Inventory!$A:$A) ,13) My spreadsheet it large and I am going to keep adding to it. I want all the information to be in the pivot table. Thank you for your help. |
#4
|
||||
|
||||
To add the code click on the sheet's tab and "view code".
In the window click the left dropdown at the top and select worksheet, then the right dropdown and select " Activate". Then paste the code and save. Whenevre the window is activated the PT will refresh. Be certain to give the correct Pivot Table name instead of " MyPivot".As for the dynamic range, declare your range as a table and use the table as data source. ( Hope all that is correct I'm no good at VBA)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#5
|
|||
|
|||
Thank you for your help. I will the code. I will also define the data as a table. Is the table option under insert. It used to be where you defined a data range and named it. I am running 2013.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Countif with filter | epnhakon | Excel | 3 | 08-29-2014 09:46 AM |
COUNTIF Formula | teza2k06 | Excel | 3 | 02-13-2014 12:37 PM |
Countif | hockeytown | Excel | 3 | 01-05-2013 08:06 AM |
Countif issue | Katy I | Excel | 2 | 07-11-2012 06:30 AM |
Countif with 2 criteria | ibrahimaa | Excel | 3 | 05-23-2011 11:23 AM |