+ Reply to Thread
Results 1 to 16 of 16

COUNTIF between dates

  1. #1
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    COUNTIF between dates

    Hi,

    I am trying to do a countif between two dates using =COUNTIFS(A:A,">="&D9,A:A,"<="&E9) the trouble is what I am counting is in the format "27/07/2013 02:52:09"

    See the attached $$, hope you can help? I'm sure there's a simple fix...

    countif between two dates.xlsx

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: COUNTIF between dates

    Hello
    You can't apply the criteria >= <= to text, as there is no value to work with. Your column of dates and times are text values. You will have to convert these to numerical values. Are you able to do that with your actual data?

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

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


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


    using the Dynamic Named Range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    Re: COUNTIF between dates

    Quote Originally Posted by DBY View Post
    Hello
    You can't apply the criteria >= <= to text, as there is no value to work with. Your column of dates and times are text values. You will have to convert these to numerical values. Are you able to do that with your actual data?
    Unfortunately the data comes as is. I don't know if you can convert it?

  5. #5
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: COUNTIF between dates

    As an alternative, you could use:

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


    Here you would not need to convert the dates in the column, as SUMPRODUCT & VALUE do it for you.

  6. #6
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    Re: COUNTIF between dates

    Quote Originally Posted by TMS View Post
    Formula: copy to clipboard
    Please Login or Register  to view this content.


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


    using the Dynamic Named Range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    This is great, but really I want to do this to the whole of A:A. After that works I want to add COUNTIF's statements like H:H,"Y". Not sure this can be done with the above formulas?

  7. #7
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    Re: COUNTIF between dates

    Quote Originally Posted by DBY View Post
    As an alternative, you could use:

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


    Here you would not need to convert the dates in the column, as SUMPRODUCT & VALUE do it for you.
    Again, I need to so this with A:A and eventually I want to add more countif statements like H:H,"Y". This is a tricky one...

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    You can't use SUMPRODUCT with entire columns ... well, strictly, you can if you have 2007 or above, but it is not recommended.

    However, the second option, using the Dynamic Named Range, will cater for all the data in column A without having to cope with thousands of blank rows.

    Have a closer look at the second formula and how the Named Range is defined, and then look at the updated example.

    Regards, TMS

  9. #9
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: COUNTIF between dates

    Trevor has given you an example of a dynamic range which grows as you add data. There is no need to reference the whole column, it's not very efficient and I believe SUMPRODUCT fails if you do that.

    *Sorry Trevor didn't see your reply.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    Please don't repeat whole posts; it just adds clutter. Refer to specific contributors and or relevant parts of the post.

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


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


    Regards, TMS

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    @DBY: no problem

  12. #12
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    Re: COUNTIF between dates

    Quote Originally Posted by TMS View Post
    Please don't repeat whole posts; it just adds clutter. Refer to specific contributors and or relevant parts of the post.

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


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


    Regards, TMS
    Could you send me these in the $$ please?

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    Updated example:
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    08-19-2014
    Location
    Sussex, England
    MS-Off Ver
    2010
    Posts
    141

    Re: COUNTIF between dates

    Quote Originally Posted by TMS View Post
    Updated example:
    lovely thanks!

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    You're welcome.

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: COUNTIF between dates

    Thanks for the rep.

+ 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. COUNTIF using dates
    By bradleyandrewdavis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-08-2015, 01:45 PM
  2. Countif between dates help
    By Lensmeister in forum Excel General
    Replies: 3
    Last Post: 11-11-2011, 08:24 AM
  3. COUNTIF function with Dates & due dates.
    By kcowper in forum Excel General
    Replies: 3
    Last Post: 03-10-2011, 12:51 AM
  4. [SOLVED] Countif using dates
    By Bugaglugs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  5. [SOLVED] Countif using dates
    By Bugaglugs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 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