+ Reply to Thread
Results 1 to 8 of 8

Counting and specifying dates that fall within a predetermined range

  1. #1
    Registered User
    Join Date
    09-11-2015
    Location
    United States
    MS-Off Ver
    2007/2010
    Posts
    8

    Counting and specifying dates that fall within a predetermined range

    Hello,

    I have a table of dates corresponding to a certain ID. Each ID has a start date and an end date associated with it, and I need only the dates that fall within that start and end. An example of what a small part of my table would look like is the following:

    example excel table.png

    (I have attached the excel document in case you are unable to view images)

    Example Excel Table.xlsx

    I need a formula that I can then apply to a large amount of data in order to know the number of events falling into the specified date range for each ID, and the earliest date that falls into the specified range.

    Thank you for your help!
    Devin
    Last edited by devdevdev51; 11-30-2015 at 01:43 PM. Reason: Added attachment

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,819

    Re: Counting and specifying dates that fall within a predetermined range

    Many contributors (including me) are not able to view .png files on this forum, due to incompatibilities with some browsers. Please attach a sample Excel workbook instead, otherwise your thread means nothing to us.

    Pete

  3. #3
    Registered User
    Join Date
    09-11-2015
    Location
    United States
    MS-Off Ver
    2007/2010
    Posts
    8

    Re: Counting and specifying dates that fall within a predetermined range

    I apologize. I have edited the original post. Thank you.

    Devin

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Counting and specifying dates that fall within a predetermined range

    If I understand you correctly, try this in E4 and copy across...
    =COUNTIFS($B:$B,"<="&E$2,$B:$B,">="&$E$3)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,366

    Re: Counting and specifying dates that fall within a predetermined range

    Try

    =SUMPRODUCT(($E2:$G2>=$B2)*($E2:$G2<=$C2)) #event

    =MIN(IF((E2:G2>=B2)*(E2:G2<=C2),E2:G2)) earliest event

    Enter the latter with Ctrl+Shift+Enter

  6. #6
    Registered User
    Join Date
    09-11-2015
    Location
    United States
    MS-Off Ver
    2007/2010
    Posts
    8

    Re: Counting and specifying dates that fall within a predetermined range

    Quote Originally Posted by FDibbins View Post
    If I understand you correctly, try this in E4 and copy across...
    =COUNTIFS($B:$B,"<="&E$2,$B:$B,">="&$E$3)
    Quote Originally Posted by FDibbins View Post
    If I understand you correctly, try this in E4 and copy across...
    =COUNTIFS($B:$B,"<="&E$2,$B:$B,">="&$E$3)
    I don't think I explained myself correctly, but your equation was helpful.

    I pasted the following in I2 and copied down, which gave me the correct values of "2" in I2 and "3" in I3, representing 2 dates falling within the first range and 3 dates falling within the second.
    =COUNTIFS(E2:G2,"<="&C2,E2:G2,">="&B2)

    So the first problem is solved! Thank you. Does anyone know how I can display the earliest date in column J?

    Thanks,
    Devin

  7. #7
    Registered User
    Join Date
    09-11-2015
    Location
    United States
    MS-Off Ver
    2007/2010
    Posts
    8

    Re: Counting and specifying dates that fall within a predetermined range

    Quote Originally Posted by JohnTopley View Post
    Try

    =SUMPRODUCT(($E2:$G2>=$B2)*($E2:$G2<=$C2)) #event

    =MIN(IF((E2:G2>=B2)*(E2:G2<=C2),E2:G2)) earliest event

    Enter the latter with Ctrl+Shift+Enter
    Your solution worked perfectly! I appreciate the help everyone. I will mark the thread as solved.

    Thank you!
    Devin

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Counting and specifying dates that fall within a predetermined range

    Glad you got what you needed, thanks for the feedback

+ 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. counting the number of dates that fall within a given week
    By john dalton in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-11-2013, 05:40 PM
  2. [SOLVED] Counting Dates that Fall in Specific Quarter
    By tylerf in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-19-2013, 03:30 PM
  3. [SOLVED] Counting how many dates in a range fall into this week and last week
    By AneelK in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-08-2013, 09:38 AM
  4. Replies: 3
    Last Post: 12-08-2011, 06:59 PM
  5. Replies: 3
    Last Post: 04-08-2009, 04:00 PM
  6. Replies: 6
    Last Post: 02-02-2009, 01:57 PM
  7. Counting Dates that fall within a certain month
    By wnstar21 in forum Excel General
    Replies: 9
    Last Post: 01-26-2009, 12:24 PM
  8. Counting cells base on a predetermined range
    By [email protected] in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-16-2005, 03:45 PM

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