Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default need help on either doing a loop and counting specific values orusing subtotal function

Hi all,

I have saw plenty of questions similiar to mine and i copied every single code snippet i could and tweeked it but i get the wrong value.

I have 2 worksheets(Raw data & Report). On the 'Report' worksheet which has summarized data i click an option button to filter the 'Raw data' worksheet. It works great! Now with that filter on say column 'BU' i have another column (AW) that has number values (Raw data worksheet).

I need to count those values in column 'AW'(e.g '=30' can have 20 entries) on the Raw Data worksheet and report those numbers on the Report worksheet.

I can get it to count all values =30 but it doesnt respect the filter and counts them all. I tried countif, subtotal, dcount, and looping statement.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default need help on either doing a loop and counting specific values or using subtotal function

Hi Mike,

Am Thu, 30 Jan 2014 12:46:17 -0800 (PST) schrieb Mike Ruiz:

I need to count those values in column 'AW'(e.g '=30' can have 20 entries) on the Raw Data worksheet and report those numbers on the Report worksheet.

I can get it to count all values =30 but it doesnt respect the filter and counts them all. I tried countif, subtotal, dcount, and looping statement.


try:

Sub Test()
Dim LRow As Long
Dim myCount As Long
Dim rngC As Range

With Sheets("Report")
LRow = .Cells(.Rows.Count, "BU").End(xlUp).Row
For Each rngC In .Range("AW2:AW" & LRow) _
.SpecialCells(xlCellTypeVisible)
If rngC = 30 Then
myCount = myCount + 1
End If
Next
End With
MsgBox myCount
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default need help on either doing a loop and counting specific values orusing subtotal function

On Thursday, January 30, 2014 3:57:45 PM UTC-5, Claus Busch wrote:
Hi Mike, Am Thu, 30 Jan 2014 12:46:17 -0800 (PST) schrieb Mike Ruiz: I need to count those values in column 'AW'(e.g '=30' can have 20 entries) on the Raw Data worksheet and report those numbers on the Report worksheet.. I can get it to count all values =30 but it doesnt respect the filter and counts them all. I tried countif, subtotal, dcount, and looping statement. try: Sub Test() Dim LRow As Long Dim myCount As Long Dim rngC As Range With Sheets("Report") LRow = .Cells(.Rows.Count, "BU").End(xlUp).Row For Each rngC In .Range("AW2:AW" & LRow) _ .SpecialCells(xlCellTypeVisible) If rngC = 30 Then myCount = myCount + 1 End If Next End With MsgBox myCount End Sub Regards Claus B. -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2




That worked!!!!!! Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
count specific subtotal values only katagrga Excel Discussion (Misc queries) 8 May 1st 09 01:29 PM
Counting a specific range of values within a column kenm Excel Discussion (Misc queries) 7 January 2nd 07 08:34 PM
Loop thru lines of text in a cell and extract specific values: please help? Mslady[_23_] Excel Programming 2 April 3rd 06 03:22 PM
Lookup Function - Specific Values Steve Elliott Excel Worksheet Functions 6 April 9th 05 07:15 PM
Counting unique entries in column A but only if specific values appear in columns B and C markx Excel Worksheet Functions 1 February 10th 05 11:52 AM


All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"