Closed Thread
Results 1 to 11 of 11

COUNTIF? (Count number of date values in a column more than 30 days old)

  1. #1
    Registered User
    Join Date
    04-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    19

    COUNTIF? (Count number of date values in a column more than 30 days old)

    Hello,

    I'm working with a spreadsheet which tracks the status of various projects over a date range. New projects come in and are automatically assigned daily. I want to set several cells within the spreadsheet to tell me:

    1. How many total tasks there are. I already have this part working, with:
    PHP Code: 
    =COUNT($F:$F
    2. How many tasks are overdue. I've tried:
    PHP Code: 
    =COUNTIF($F:$F,TODAY()-$F2>=30
    Strangely, this doesn't do anything.

    3. How many tasks are new since the prior workday. I have tried:
    PHP Code: 
    =COUNTIF($F:$F,IF(WEEKDAY(TODAY())=2,TODAY()-$F1<=3,TODAY()-$F1<=1)) 
    Modeled this after conditional formatting I'm using on the same column, and this also does not work.

    Thanks.
    Last edited by kaeroku; 05-03-2012 at 03:01 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Maybe these?

    =SUMPRODUCT(--(TODAY()-$F2:$F$100>=30))

    =SUMPRODUCT(--(TODAY()-$F1:$F$100<=3),--(TODAY()-$F1:$F$100>=1))

    using defined ranges instead of whole ranges is more effiecient....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    2. =countif($f:$f,"<="&today()-30)

    3. =countif($f:$f,today()-if(weekday(today())=2,3,1))

  4. #4
    Registered User
    Join Date
    04-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Quote Originally Posted by NBVC View Post
    Maybe these?

    =SUMPRODUCT(--(TODAY()-$F2:$F$100>=30))

    =SUMPRODUCT(--(TODAY()-$F1:$F$100<=3),--(TODAY()-$F1:$F$100>=1))

    using defined ranges instead of whole ranges is more effiecient....
    When I copy your formulas into a cell in my sheet, the first one returns the value "99" and does not change when I add date values within the intended range. However, when I add FUTURE dates, it starts counting down from 99... not the desired functionality here.

    The second formula gives a #value! error, which I can't debug.

    In any case, I see two probable issues: one, I'm using $F:$F because my data fluctuates between 0 and 1000 values, but can exceed that number... in theory I could have hundreds of thousands of values, though if that ever happens someone else will be doing my job.
    Secondly, I'm not sure what Sumproduct actually does. I'm using countif because I want to determine how many tasks there are, and I know CountIF counts cells with numeric values within the range specified (and I thought, based on conditions set for it.) I don't want it to SUM my dates within the range, I want it to count the number of cells containing date values.


    Quote Originally Posted by Bob Phillips View Post
    2. =countif($f:$f,"<="&today()-30)

    3. =countif($f:$f,today()-if(weekday(today())=2,3,1))
    Your 2. works great, thank you.

    Your 3. Returns 0 no matter what values I put in the cells. I changed weekday(today())=5, so that it would accurately reflect the conditions of today (actual) for testing purposes, rather than the intended use of the formula (which would detect Mondays and count incoming tasks since Friday)
    Last edited by kaeroku; 05-03-2012 at 03:19 PM.

  5. #5
    Registered User
    Join Date
    04-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Quote Originally Posted by Bob Phillips View Post
    2. =countif($f:$f,"<="&today()-30)

    3. =countif($f:$f,today()-if(weekday(today())=2,3,1))
    I just tried
    =countif($f:$f,today()-$F1<=if(weekday(today())=2,3,1))

    I still get a result of 0 no matter what I enter in the F column

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Yeah, I think Bob understood your request better than I....

  7. #7
    Registered User
    Join Date
    04-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Quote Originally Posted by NBVC View Post
    Yeah, I think Bob understood your request better than I....
    It's fine, thanks for taking a look! I'm sorry if I didn't explain it well.

    In any case, I think I got it!

    3.
    =COUNTIF($F:$F,">="&IF(WEEKDAY(TODAY())=5,TODAY()-3,TODAY()-1))

    Thanks again, all!

  8. #8
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Quote Originally Posted by kaeroku View Post
    In any case, I think I got it!

    3.
    =COUNTIF($F:$F,">="&IF(WEEKDAY(TODAY())=5,TODAY()-3,TODAY()-1))
    Are you sure about that. WEEKDAY(date)=5 tests for Thursday not Monday. Today is Thursday, so it will count all dates of 30th April. Next Monday, 7th, it will count all dates of 6th May. That doesn't sound like what you wanted.

  9. #9
    Registered User
    Join Date
    04-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Quote Originally Posted by Bob Phillips View Post
    Are you sure about that. WEEKDAY(date)=5 tests for Thursday not Monday. Today is Thursday, so it will count all dates of 30th April. Next Monday, 7th, it will count all dates of 6th May. That doesn't sound like what you wanted.
    You're absolutely right. However, since yesterday was Thursday, I had to have it set to =5 to validate the formula was functioning properly (and linked as such in case others missed it.) I switched it to =2 in my sheet - thank you for pointing it out though!

  10. #10
    Registered User
    Join Date
    11-27-2020
    Location
    Libreville
    MS-Off Ver
    Office 10
    Posts
    42

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Re: COUNTIF? (Count number of date values in a column 30 days before expiry)

    I am rather trying to count dates in a column that will expire in 30 days from today's date. This is killing me

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,832

    Re: COUNTIF? (Count number of date values in a column more than 30 days old)

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

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