+ Reply to Thread
Results 1 to 8 of 8

COUNT if Date is between two dates.

  1. #1
    Registered User
    Join Date
    03-03-2014
    Location
    Newcastle, NSW, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    COUNT if Date is between two dates.

    G'day guys,
    Long time listener, first time caller.

    I'm trying to find a formula that will count the number of times an 'item' is beding used within the same date range.
    - this is essentially the same thing as Resource Usage in Microsoft Project, but I need it in Excel.

    This is what I have thus far:
    A B C D
    1 Item Number Start Date Finish Date Calculation
    2 A1152 2/01/2014 12/01/2014 =COUNTIFS(A:A,A1,B:B,">="&B2,C:C,"<="&C2)
    3 A1152 1/01/2014 11/01/2014
    4 B2263 2/01/2014 12/01/2014
    5 B2263 1/01/2014 11/01/2014
    6 A1152 3/01/2014 13/01/2014


    The result should be '3', given that the same 'Item' is being used 3 times withing the same timeframe (for Item Number A1152).

    Any assistance would be greatly appreciated, as I've been stuck on this for Days!!

    Cheers
    Steve

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: COUNT if Date is between two dates.

    Hi, another Novocastrian!

    Try this formula in D2, then drag it down the column as far as is necessary:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Now for the explanation:
    The first SUMPRODUCT sums up the number of rows of the same item which overlap the start date, and the second SUMPRODUCT sums up the number of rows of the same item which start after the current row start but before the current row finishes.

    I hope this helps
    Last edited by ajryan88; 03-03-2014 at 08:17 PM.

  3. #3
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,794

    Re: COUNT if Date is between two dates.

    what answer do you get

    row 6 has 13/1/14
    which is not less than or = to C2 12/1/14

    row 3 has 1/1/14
    which is not greater than or = to B2 2/1/14

    so the answer is 1 and not 3

    Also your AA criteria is looking at A1 and not A2
    =COUNTIFS(A:A,A1,B:B,">="&B2,C:C,"<="&C2)
    Last edited by etaf; 03-03-2014 at 08:24 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: COUNT if Date is between two dates.

    @etaf: No the answer is 3, as I believe the OP is attempting to determine if there was ANY overlap of the dates, not a complete overlap/nesting of the dates.

  5. #5
    Registered User
    Join Date
    03-03-2014
    Location
    Newcastle, NSW, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: COUNT if Date is between two dates.

    @ajryan88, how funny, another Novocastrian.
    what you have done there is So close, but I think you've nailed it when you said that I'm looking for ANY overlap.

    I've attached a file of what I am trying to achieve (a simple version of a greater file).

    If there are any overlaps, it should couny it. with the formula that you provided, it's not counting all.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: COUNT if Date is between two dates.

    The problem was that you translated the formula incorrectly.

    In the attachment, I have setup some Named Ranges for you so that your formulae aren't looking up ENTIRE columns, rather just the cells that need to be looked up, and I have corrected your formulas.

    My formula said
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and your formula was translated incorrectly as below, shown in red:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I hope this helps

  7. #7
    Registered User
    Join Date
    03-03-2014
    Location
    Newcastle, NSW, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: COUNT if Date is between two dates.

    That is amazing, absolutely amazing.
    Thank you so much ajryan88

  8. #8
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: COUNT if Date is between two dates.

    You're welcome Glad I could help.

    Please don't forget to mark this thread as solved, and please click on the * next to my post to say thanks and add to my reputation

+ 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. Replies: 8
    Last Post: 02-08-2013, 04:29 AM
  2. Replies: 4
    Last Post: 02-02-2012, 09:24 AM
  3. Replies: 7
    Last Post: 07-05-2009, 06:24 AM
  4. Count if date is between two dates and value in another column equ
    By mg_sv_r in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2005, 10:35 AM
  5. Count rows if date is between two specified dates
    By mg_sv_r in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-15-2005, 09:25 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