+ Reply to Thread
Results 1 to 11 of 11

CountIf for Each SubTotal

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    New York
    MS-Off Ver
    2010
    Posts
    9

    CountIf for Each SubTotal

    I have read through the other threads on this topic and understand the use of SumProduct when want the count for all the rows in a given column. What I need is to be able for each SubTotal (I have ~3000 rows, yielding ~750 different subtotal rows). What I want is to have a separate count for each of the 750 subtotals, of within the group, how many contained a particular value. For Example, I am counting Column G which has values A, B, C, D. So if for one subtotal, I have a total of 10 rows (A,B,A,C,D,A,B,A,C,D), I want a count of only the number of those 10 rows, that contained the letter A in Column G. I would want the subtotal to be 4. Is this possible?

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: CountIf for Each SubTotal

    =COUNTIFS(G:G,"A") would give you the number of times 'A' is listed in column G.
    Within a specific sub group in that column would require an extra criteria. You haven't stated what determines the subgroups though.

    So if we assume your groups are determing by column F and there are three groups listed in this column (grp1,grp2,grp3) then you can count the number of A's in grp1 by altering the formula to:

    =COUNTIFS(G:G,"A",F:F,"grp1")


    If this doesn't make sense or provide the solution you are after please provide a small sample file with non sensitive data so that we can better understand your requirements.
    Last edited by Harribone; 12-01-2020 at 01:41 PM.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    Hi there.

    A picture is worth 1,000 words. An Excel sheet is worth 1,000 pictures.

    Please read the yellow banner about sample worksheets, at the top of the screen. Act on its guidelines and post a SMALL sample sheet.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    06-27-2014
    Location
    New York
    MS-Off Ver
    2010
    Posts
    9

    Re: CountIf for Each SubTotal

    Have attached a sample spreadsheet. What I would like to be able to do is to ues the subtotal function but in Column D have the subtotal row show the count of the number of rows that have "Match" Needless to say the sheet does other functions and uses vlookup to get to the point of what I am trying to do. Bottom line question - is it possible to use the subtotal function on Column D and have it only count if the cell has the specific value for each subtotal - as I said in the original, it is a rather large spreadsheet and will have over 750 subtotal rows.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    Hi. I am baffled. There are no subtotals in your sample. I have no idea what you are trying to achieve...

    =COUNTIF(D4:D8,"Match")

    will count the number of "Match" values in the range... ????

  6. #6
    Registered User
    Join Date
    06-27-2014
    Location
    New York
    MS-Off Ver
    2010
    Posts
    9

    Re: CountIf for Each SubTotal

    Tried to keep the sample as small as possible, so only left one set of data with the subtotal on top - Row 3 is the subtotal for the one set of data shown; and Row 2 has the Grand Total which would be if I had left more samples. I know how to use CountIF on a Column - I was hoping there was a way that I could incorporate it with using the SubTotal Function as used on row 3.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    Can you post another slightly larger sample, with a few subtotals, looking EXACTLY the way they do in your real sheet. Why do you want to use SUBTOTAL in particular? Are the spaces in D4 to D6 of your current sample really present in your real data?

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    Also, please don't include ANY formulae that are NOT in your real data. i can't see what is your starting point and what is your attempt to get to a solution.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    A wild guess. See sheet. Is this anywhere close??
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-27-2014
    Location
    New York
    MS-Off Ver
    2010
    Posts
    9

    Re: CountIf for Each SubTotal

    YES to the Wild Guess!!!! Just tried using in a new column and it gives me the result I need. Thank You.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: CountIf for Each SubTotal

    Woo Hoo!!!

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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] Subtotal countif
    By Median in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-20-2018, 08:37 PM
  2. How to do COUNTIF with SUBTOTAL
    By ZOZOZIAD in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2018, 09:02 AM
  3. [SOLVED] Subtotal and Countif
    By Lehany in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-10-2014, 01:53 PM
  4. [SOLVED] =Subtotal(countif,Range); Subtotal and countif in 1 formula [SOLVED]
    By thomas.mapua in forum Excel General
    Replies: 5
    Last Post: 01-06-2012, 11:33 AM
  5. Countif in subtotal
    By coolzero in forum Excel General
    Replies: 1
    Last Post: 05-25-2011, 03:41 PM
  6. If, Countif, Subtotal...?
    By richandjo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2008, 06:44 AM
  7. [SOLVED] > but < subtotal (3,...) or countif
    By PAR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-22-2006, 05:55 AM

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