Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JSS JSS is offline
external usenet poster
 
Posts: 1
Default Formula to count text string in column cells of filtered rows

What is the formula to return the number of specified matching text in a
colukn but only for the rows showing after a filter is applied?

Example: How many incidences of "Pass" are there if a filter is applied to
see only dates 1/1/2009 and 3/1/2009? I tried =COUNTIF and I get the total
of all "Pass". Not the filtered data.

Date Result
1/1/2009 Pass
2/1/2009 Fail
3/1/2009 Pass
4/1/2009 Pass
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Formula to count text string in column cells of filtered rows

With from to dates in C2 and D2
=SUMPRODUCT((A1:A10=C2)*(A1:A10<=D2)*(B1:B10="Pas s"))

If this post helps click Yes
---------------
Jacob Skaria


"JSS" wrote:

What is the formula to return the number of specified matching text in a
colukn but only for the rows showing after a filter is applied?

Example: How many incidences of "Pass" are there if a filter is applied to
see only dates 1/1/2009 and 3/1/2009? I tried =COUNTIF and I get the total
of all "Pass". Not the filtered data.

Date Result
1/1/2009 Pass
2/1/2009 Fail
3/1/2009 Pass
4/1/2009 Pass

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Formula to count text string in column cells of filtered rows

Try this...

Assume the full unfiltered range is B2:B15.

=SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B15,ROW(B2:B15)-ROW(B2),0,1)),--(B2:B15="pass"))

--
Biff
Microsoft Excel MVP


"JSS" wrote in message
...
What is the formula to return the number of specified matching text in a
colukn but only for the rows showing after a filter is applied?

Example: How many incidences of "Pass" are there if a filter is applied to
see only dates 1/1/2009 and 3/1/2009? I tried =COUNTIF and I get the
total
of all "Pass". Not the filtered data.

Date Result
1/1/2009 Pass
2/1/2009 Fail
3/1/2009 Pass
4/1/2009 Pass



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Formula to count text string in column cells of filtered rows

Using the following User Defined Function will get you the result whatever
criteria autofiltering is using:

Public Function fCount(rr As Range, s As String) As Long
Application.Volatile
Dim r As Range
fCount = 0
For Each r In rr
If r.EntireRow.Hidden < True Then
If r.Value = s Then
fCount = fCount + 1
End If
End If
Next
End Function


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function:

=fCount(B1:B100,€¯Pass€¯)

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx


--
Gary''s Student - gsnu200906


"JSS" wrote:

What is the formula to return the number of specified matching text in a
colukn but only for the rows showing after a filter is applied?

Example: How many incidences of "Pass" are there if a filter is applied to
see only dates 1/1/2009 and 3/1/2009? I tried =COUNTIF and I get the total
of all "Pass". Not the filtered data.

Date Result
1/1/2009 Pass
2/1/2009 Fail
3/1/2009 Pass
4/1/2009 Pass

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 Advanced Filtered Rows Daren Excel Worksheet Functions 3 February 25th 09 09:14 PM
How do I count the number of filtered rows 2D Rick Excel Worksheet Functions 2 January 7th 07 03:36 AM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 8 May 18th 05 04:23 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 0 May 15th 05 08:14 PM


All times are GMT +1. The time now is 10:43 AM.

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

About Us

"It's about Microsoft Excel"