+ Reply to Thread
Results 1 to 24 of 24

How to return the number of text cells in a filtered range

  1. #1
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    How to return the number of text cells in a filtered range

    Hi All,

    I am looking to calculate the number of cells that contain "PASS" which is mixed amongst other cells. I can use COUNTIF, but can i apply this formulae to visable cells only?

    I have added subtotal103, however i think this will only work if the other cells are blank.

    Please help.

    Thanks,

    Adam

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to return the number of text cells in a filtered range

    Adam

    SUBTOTAL should work with filtered data, and I'm pretty sure it has nothing to do with blank cells.

    How exactly did you try it?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi Norie,

    Thanks for the reply.

    I used the following but its returning an error. i presume it is because i am double counting. Apart from countif, i am not sure how to count text cells.

    =SUBTOTAL(102, COUNTIF(N26:N72, "Pass"))

    Thanks,

    Adam

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to return the number of text cells in a filtered range

    How have you filtered?

  5. #5
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Pass and fail is accumulated by meeting certain criteria which is found by looking at several cells. The problem arises when i want to look at how many passed and failed when one specific set of results is held constant.

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,625

    Re: How to return the number of text cells in a filtered range

    Pl see file with UDF subCountIF
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi,

    I have attached an example on sheet 2.

    If i wanted to look at purple items only or maybe yellow.

    Thanks,

    Adam
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi KVS,

    How do i add that new function to Excel, It looks to work fine.

  9. #9
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Anybody please ?? =(

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to return the number of text cells in a filtered range

    Try this it will count the Pass in column K where column C is Purple.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Same but using COUNTIFS.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: How to return the number of text cells in a filtered range

    How about this with helper column?
    Attached Files Attached Files
    Quang PT

  12. #12
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Thanks Norie,

    What i would like to achieve is be able to change the first filter and it will always give me the %passed. The attached excel sheet is very basic. My current sheet will contain alot of variables.

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to return the number of text cells in a filtered range

    I prefer to put the subtotal in it's own column.
    Particularly if there will be multiple formulas that need to work with only visible cells.

    So in an available column, say M, Put
    M2: =SUBTOTAL(103,N2)
    and fill down.

    Now use
    COUNTIFS(M26:M72,1,N26:N72, "Pass")

  14. #14
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi Jonmo1,

    Can you please have a look at my excel and see what im doing wrong. I understand it probably looks stupid as i am selecting boxs with nothing in it.

    I was thinking about having a hidden coloum and in that column returning a 0 for a fail and a 1 for a pass. Then using subtotal can count the 1s. Is that possible? Maybe an IF function?

  15. #15
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: How to return the number of text cells in a filtered range

    in your yellow cell K1

    =SUMPRODUCT(--(K5:K100="Pass"),SUBTOTAL(3,OFFSET(K5,ROW(K5:K100)-ROW(K5),0)))

    note the range is just until K100 on the sample above
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  16. #16
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    I dont quite understand the coding but it works perfectly.

    Thanks very much for your help =)

  17. #17
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: How to return the number of text cells in a filtered range

    Nice. Your welcome.

    regards,
    vlady

  18. #18
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hmmm i double posted by acciedent
    Last edited by Adamlee; 03-10-2015 at 05:09 AM.

  19. #19
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi Vlad,

    I have added an extra cell to the excel sheet which i am trying to figure out. I have uploaded it in a new thread. If you get the chance could you please take a look.

    Thanks,

    Adam

  20. #20
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to return the number of text cells in a filtered range

    Quote Originally Posted by Adamlee View Post
    Hi Jonmo1,

    Can you please have a look at my excel and see what im doing wrong.
    Here's an example using the method I described in post #13
    EFAdamlee.xlsx

  21. #21
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    Hi Jonmo,

    You know the way you have the 1 being produced when the first column reads a color. Is it possible to use the same formula without having a color?

    eg. It wil return a 1 for any text?

  22. #22
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to return the number of text cells in a filtered range

    Yes, the formula I put in column L will return a 1 if there is ANY value in column C AND that cell is Visible after autofilter.
    It will be 0 if the cell in column C is empty OR Not Visible after autofilter.

  23. #23
    Registered User
    Join Date
    02-16-2015
    Location
    Ireland
    MS-Off Ver
    2010
    Posts
    64

    Re: How to return the number of text cells in a filtered range

    That is exactly what i wanted. I got confused because it said color in the fomula but i presume that it is because its the name of the column?

    Thanks so much.

  24. #24
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to return the number of text cells in a filtered range

    You're welcome.

    Quote Originally Posted by Adamlee View Post
    but i presume that it is because its the name of the column?
    That's correct.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] If cell contains text contained in a named range return the row number
    By spoursy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-05-2014, 05:54 AM
  2. Replies: 9
    Last Post: 03-06-2014, 04:48 PM
  3. Replies: 2
    Last Post: 09-07-2013, 07:50 PM
  4. [SOLVED] Return specific text if a different text is contained anywhere in a range of cells
    By ciayers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2013, 05:54 PM
  5. How to return largest number within a range of cells
    By superdow in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-26-2009, 03:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1