+ Reply to Thread
Results 1 to 9 of 9

Subtotal and Countif

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    35

    Subtotal and Countif

    Hi,. I've searched this and other forums to try to find a solution to my problem but cant find one that I can make sense of and transfer it to my worksheet, so I'm hoping somebody will be able to help.

    On tab 1 of my workbook I have dates of employee training and dates when this training is due for renewal. This can be filtered into different staff groups. On tab two I have statistical data calculated from the info on tab 1. I need a formula on tab 2 to count the number of staff due to renew training, which I have done by using the formula

    =COUNTIF('Training Records'!G6:G173,"<"&$K$1)

    i.e. count if the renewal due date is prior to today ('Training Records being the name of tab 1, and K1 being todays date). My problem is that when tab 1 has been filtered to a specific staff group, I need this to only count those in the filtered list but cant work out a way to do this as SUBTOTAL doesnt work with COUNTIF.

    I hope that makes sense! Thanks for any help you can give me.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Subtotal and Countif

    Look at the formula subtotal to only count / sum the filtered values.

    Otherwise post an excel file, without confidential information.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    07-10-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    35

    Re: Subtotal and Countif

    Hi, sorry I dont understand what you mean? I cant find a way to use subtotal with countif.

    I've attached a small sample of the workbook with all confidential info removed. So its the formula in column D on the Statistical Report tab that I need help with. It refers to the training records tab which would normally be filtered by the Organisation Unit column, e.g. South Central. I need the formula to only count if the date is prior to today, and only for the filtered staff.

    Thanks very much.
    Attached Files Attached Files

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Subtotal and Countif

    I didn't download your file.

    Sounds like you want something like this:

    =SUMPRODUCT(SUBTOTAL(3,OFFSET('Training Records'!G6,ROW('Training Records'!G6:G173)-ROW('Training Records'!G6),0)),--('Training Records'!G6:G173<$K$1))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    07-10-2014
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    35

    Re: Subtotal and Countif

    Quote Originally Posted by Tony Valko View Post
    I didn't download your file.

    Sounds like you want something like this:

    =SUMPRODUCT(SUBTOTAL(3,OFFSET('Training Records'!G6,ROW('Training Records'!G6:G173)-ROW('Training Records'!G6),0)),--('Training Records'!G6:G173<$K$1))
    Tonky Valko you are a star! That works perfectly! Thank you very much.

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Subtotal and Countif

    Quote Originally Posted by Lehany View Post
    Tonky Valko you are a star! That works perfectly! Thank you very much.
    I agree with you. He has provided a wonderful formula indeed.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Subtotal and Countif

    Thanks!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Subtotal and Countif

    You're welcome. Thanks for the feedback!

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Subtotal and Countif

    b2
    =SUBTOTAL(103,'Training Records'!D$6:D$173)
    What is wrong with this formula.

    I think it works like expected.

    You can add another column for other criteria (and then you can filter on that column also).

+ 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. Mix countif with subtotal
    By ExcelFailure in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-06-2014, 04:00 AM
  2. [SOLVED] Countif in Subtotal
    By lemuel in forum Excel General
    Replies: 3
    Last Post: 11-06-2012, 05:14 PM
  3. [SOLVED] Subtotal countif?
    By freud1 in forum Excel General
    Replies: 12
    Last Post: 10-02-2012, 07:31 AM
  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

Tags for this Thread

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