+ Reply to Thread
Results 1 to 10 of 10

IF using using multiple COUNTIFS functions

  1. #1
    Registered User
    Join Date
    11-22-2019
    Location
    London
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    5

    Question IF using using multiple COUNTIFS functions

    Hi, this may be a simple solution but I've been stuck for a while now.

    I'm trying to get a count of dates within that are before today's date, within 30 days from today, between 30 & 60 days away and further than 60 days away.

    The catch is that I need to use two columns (planned dates and revised dates). If there is a revised date, I want the formula to only use the revised date but if the revised date cell is blank, to use the planned date.

    There are more categories in the counts (hence I'm using COUNTIFS) but I haven't included them as they are not what's causing the issue, they're just identifiers so it's counting the right category.

    I just want to isolate them so it's counting using one column (P "Revised Date") or the other (O "Planned Date").

    I've added verbally what I'm trying to make it do and the formula I'm using.

    Really appreciate any help on this one because I think my head is about to pop!


    Before Today:
    "If column P has a value (aka: there is a date there), count how many are before today's date. If it doesn't have a value, count the number of dates in column O that are before today's date."

    =IF($P:$P="<>",COUNTIFS($P:$P,"<"&TODAY()),COUNTIFS($O:$O,"<"&TODAY())



    Within 30 days from now:
    "If column P has a value, count how many are coming up in the next 30 days. If it doesn't have a value, count the number of dates in column O that are coming up in the next 30 days."

    =IF($P:$P="<>",COUNTIFS($P:$P,"<="&TODAY()+30),COUNTIFS($O:$O,"<="&TODAY()+30))



    Between 30 & 60 days away:
    "If column P has a value, count how many are between 30 to 60 days away. If it doesn't have a value, count how many of the dates in column O that are between 30 to 60 days away."

    =IF($P:$P="<>",COUNTIFS($P:$P,">="&TODAY()+30,$P:$P,"<="&TODAY()+60),COUNTIFS($O:$O,">="&TODAY()+30,$O:$O,"<="&TODAY()+60))



    Further than 60 days away:
    "If column P has a value, count how many are 60 days or above away. If it doesn't have a value, count how many dates on column O are more than 60 days away."

    =IF($P:$P="<>",COUNTIFS($P:$P,">"&TODAY()+60),COUNTIFS($O:$O,">"&TODAY()+60))

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF using using multiple COUNTIFS functions

    as best as I can tell, these are the formulas you need:
    before today... =COUNTIFS(P:P,"<"&TODAY(),O:O,"<"&TODAY())

    within 30 days from now: =COUNTIFS($P:$P,"<="&TODAY()+30,$O:$O,"<="&TODAY()+30)

    between 30 and 60 days away: =COUNTIFS($P:$P,">="&TODAY()+30,$P:$P,"<="&TODAY()+60,$O:$O,">="&TODAY()+30,$O:$O,"<="&TODAY()+60)

    further than 60 days away: =COUNTIFS($P:$P,">"&TODAY()+60,$O:$O,">"&TODAY()+60)
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    11-22-2019
    Location
    London
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    5

    Re: IF using using multiple COUNTIFS functions

    Thanks for the response!

    That would have been the case if only one of the columns was populated. The issue is that there is always a date in column O. But if I add a date to column P, then your formula will count both.

    I want it to count P if there is a value in it (and ignore O), but if P is blank, to only count column O.

    See what I mean?

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF using using multiple COUNTIFS functions

    hmmm, have to think on that.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF using using multiple COUNTIFS functions

    so, is this what you are looking for before today?
    =IF(COUNTA(O:O)<>COUNTA(P:P),COUNTIF(O:O,"<"&TODAY()),COUNTIFS(P:P,"<"&TODAY(),O:O,"<"&TODAY()))

    if that is the right track then that could be the adjustment to the rest.

  6. #6
    Registered User
    Join Date
    11-22-2019
    Location
    London
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    5

    Re: IF using using multiple COUNTIFS functions

    Sorry - been trying different thinks in the formula. We're getting closer...

    The IF statement at the start is still not ignoring the O column if P is populated for the other options (less than 30 days, etc.)

    So if the P is before today, and O is in the future, it is still counting before today as 1 and the one in the future as 1 as well.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF using using multiple COUNTIFS functions

    how about uploading a sample? I'm having trouble trying to test it in my own workbook where I have to keep trying to create the data I think you have.
    Follow the instructions in the yellow banner at the top of the post AND make sure it is representative of your data AND has expected results. It doesn't have to be the complete data set, just enough to see what you have AND what you expect. You can enter the results you expect by hand.

  8. #8
    Registered User
    Join Date
    11-22-2019
    Location
    London
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    5

    Re: IF using using multiple COUNTIFS functions

    Attached is a sample.

    So in it the A is O and B is P.
    Attached Files Attached Files

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF using using multiple COUNTIFS functions

    I was hoping you would upload a more complete workbook where you have examples of those missing in one column but values in the other column.

    your expected in G8 does not match the criteria.
    "If column P has a value, count how many are 60 days or above away. If it doesn't have a value, count how many dates on column O are more than 60 days away."
    I moved the info to O and P then looked at it again. Your value in P is more than 60 days away but your value in O is less than 60 days away so the criteria doesn't return a value.

    If this was mine I'd just use a helper column with an IF/THEN statement. So that if P or O were blank look at the non blank column OR the two columns and see if they are before today, within 30 days, between 30 and 60 or more than 60 days away. That would return a value that I would then count under each category.

  10. #10
    Registered User
    Join Date
    11-22-2019
    Location
    London
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    5

    Re: IF using using multiple COUNTIFS functions

    Thanks Sambo kid, really appreciate your help.

    I've adjusted the data instead to make it very easy rather than trying to be fancy with the formula.

    Basically I just renamed it "Anticipated completion date" instead of Revised and populated that entire column with the Planned dates as well. That way I only need to count what is in that one column instead and will have to track changes made to the anticipated a bit more carefully.

+ 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] Nesting Functions : Two COUNTIFS
    By yuenk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-15-2014, 09:25 AM
  2. [SOLVED] COUNTIFS and SUBTOTAL Functions Help
    By kapeller in forum Excel General
    Replies: 8
    Last Post: 09-15-2014, 06:23 PM
  3. Version limitations on Countifs functions?
    By Wiekus Britz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-17-2014, 09:45 AM
  4. COUNTIFS and MATCH functions
    By PJR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2014, 07:45 PM
  5. COUNTIFS OR...multiple countifs without duplication in the numbers
    By HooligaD in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2012, 09:53 AM
  6. Countifs with OR functions
    By bellpiero in forum Excel General
    Replies: 2
    Last Post: 03-17-2010, 12:12 PM
  7. Replies: 0
    Last Post: 11-15-2007, 05:24 AM

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