Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2015, 10:19 PM
Alaska1 Alaska1 is offline CountIF Functions Windows 7 64bit CountIF Functions Office 2007
Advanced Beginner
CountIF Functions
 
Join Date: Nov 2011
Posts: 96
Alaska1 is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 01-30-2015, 01:26 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline CountIF Functions Windows 7 64bit CountIF Functions Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

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
which will refresh when ws activated.
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
Reply With Quote
  #3  
Old 01-30-2015, 05:27 AM
Alaska1 Alaska1 is offline CountIF Functions Windows 7 64bit CountIF Functions Office 2007
Advanced Beginner
CountIF Functions
 
Join Date: Nov 2011
Posts: 96
Alaska1 is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 01-30-2015, 09:22 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline CountIF Functions Windows 7 64bit CountIF Functions Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

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
Reply With Quote
  #5  
Old 01-30-2015, 09:59 AM
Alaska1 Alaska1 is offline CountIF Functions Windows 7 64bit CountIF Functions Office 2007
Advanced Beginner
CountIF Functions
 
Join Date: Nov 2011
Posts: 96
Alaska1 is on a distinguished road
Default

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.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Countif with filter epnhakon Excel 3 08-29-2014 09:46 AM
CountIF Functions COUNTIF Formula teza2k06 Excel 3 02-13-2014 12:37 PM
Countif hockeytown Excel 3 01-05-2013 08:06 AM
CountIF Functions Countif issue Katy I Excel 2 07-11-2012 06:30 AM
CountIF Functions Countif with 2 criteria ibrahimaa Excel 3 05-23-2011 11:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft