+ Reply to Thread
Results 1 to 8 of 8

Formula to count days IF the dates fall within the period(start and end date only given)

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Exclamation Formula to count days IF the dates fall within the period(start and end date only given)

    Hi everyone, I joined this forum in dire need of help. Is there any formula to solve this? Please refer to my worksheet:

    Start Date End Date Number of days it hits the stats period
    22/3/13 24/4/13 ?????


    We have 3 stats period ( 29 April - 24 May), (29 July - 23 August), ( 21 October - 15 November)
    I need a formula to solve the number of days it falls within the stats period excluding weekends. ( Does it make sense?)

    Hope anyone can help me asap..
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    This is the standard way of getting the number of working days that one date range intersects another:

    =NETWORKDAYS(MEDIAN($H$2,$I$2,$A2),MEDIAN($H$2,$I$2,$B2))-1

    You just need three of those:

    =NETWORKDAYS(MEDIAN($H$2,$I$2,$A2),MEDIAN($H$2,$I$2,$B2))-1
    +NETWORKDAYS(MEDIAN($H$3,$I$3,$A2),MEDIAN($H$3,$I$3,$B2))-1
    +NETWORKDAYS(MEDIAN($H$4,$I$4,$A2),MEDIAN($H$4,$I$4,$B2))-1


    Put that in C2, format the cell as General, then copy down.

    NOTE: The Networkdays function takes a third parameter if you wanted to add a list of known holidays to exclude.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    hi, thanks for the reply.. sorry but I didn't mention that I already worked out the "Days in Program" column, all I need is the stats column..

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    You need the stats column to do what? Give some expected results and explain them if it isn't obvious.

  5. #5
    Registered User
    Join Date
    03-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Smile Re: Formula to count days IF the dates fall within the period(start and end date only give

    Hi, thanks for replying again,, may i ask why did you put a "-1" at the end of every formula? Kindly explain please. thanks!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    That's up to you to decide. NETWORKDAYS usually includes the first date and the second date in the answer. So if you use it give you the NetWORKDAYS that exist between 3/25/2013 and 3/26/2013, it will say 2. That's fine if you wanted to know "how many workdays are in between these two dates."

    But funny thing is most of the time that's not exactly how it's being used. Most people want to know "how many have passed between the following two dates." The answer to "how many days have passed between 3/25 and 3/26 is most often 1, so if you use NETWORKDAYS, you'll have to subtract 1 from the result. Most of the time.

    Again, it's up to you to decide if the answer is correct by including or excluding that first day.

  7. #7
    Registered User
    Join Date
    03-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    well I tried both but for example start date is 25/4 and end date is 1/5 the number of working days is 2 which is correct based on the stats period which starts on 29/4 and end on 20/5 but when you put 29/4 as the starting date and 20/5 as the end date you will only get 18 days I need to get 20 days. Can we do something about it?thanks again! =)

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to count days IF the dates fall within the period(start and end date only give

    Quote Originally Posted by angelkulit025 View Post
    ....but when you put 29/4 as the starting date and 20/5 as the end date you will only get 18 days I need to get 20 days. Can we do something about it?thanks again! =)
    Using Jerry's suggested formula I get 15 for that example - how did you get 20, which days are you counting?
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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