+ Reply to Thread
Results 1 to 18 of 18

Require a formula to indicate how many days fall within a series of months

  1. #1
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Require a formula to indicate how many days fall within a series of months

    Hi I have a sheet that has a start date and an end date for holidays.

    The start date for the test holiday is 23/05/14
    The end date for the test holidya is 15/7/14

    I need a formula that will calculate how many of the holidays (work days only Mon-Fri) fall in each month from May through July

    Thanks in advance
    J

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Require a formula to indicate how many days fall within a series of months

    if A1 is start Date and A2 is end date

    PHP Code: 
    =A2-A1-NETWORKDAYS(A1,A2,2
    Please make the Post as solved, when you get your answer & Click * if you like my suggestion

  3. #3
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    How would I implement this to display the work days in each month?

    Please see attached sheet for desired outcome.

    JD
    Attached Files Attached Files

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    Either:

    In your first cell of choice:

    =NETWORKDAYS(MAX($A$1,EOMONTH($A$1,ROWS($1:1)-2)+1),MIN($A$2,EOMONTH($A$1,ROWS($1:1)-1)))

    Copy down as required.

    Or, put May, June, July in C1, C2 and C3, and enter this in D1:

    =SUMPRODUCT(0+(TEXT(ROW(INDIRECT($A$1&":"&$A$2)),"mmmm")=C1),0+(WEEKDAY(ROW(INDIRECT($A$1&":"&$A$2)),11)<6))

    Again, copy down as required.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    Edit: I should've mentioned that both these solutions require your months to be in the same year.

    Let me know if that is potentially not the case.

    Regards

  6. #6
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    The span takes in our financial year so the holidays can span from 2014 to 2015, sorry should've mentioned.

    Cheers

    JD

  7. #7
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Can you post the sheet with the formula implemented please as I can't seem to get it owrking on either solution.

    Cheers
    JD

  8. #8
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Also would I need to add a year cell to each month to indicate which year the month fell into?

    J

  9. #9
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Require a formula to indicate how many days fall within a series of months

    Hi John, it will be easier if you can format your month name to Jan-14, Feb-14 like this for easier calculation

  10. #10
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    I have done as you have suggested but still cant get it to work

    J

  11. #11
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    Try this version:

    =IF(ROWS($1:1)>DATEDIF($A$1,$A$2,"m")+2,"",NETWORKDAYS(MAX($A$1,EOMONTH($A$1,ROWS($1:1)-2)+1),MIN($A$2,EOMONTH($A$1,ROWS($1:1)-1))))

    Copy down as required.

    You can enter your months/years next to these if you want, though the formula doesn't depend on it.

    Regards

  12. #12
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Still cant get it working.

    J

  13. #13
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    Are your dates in the cells as indicated?

    Edit: the formula should be:

    =IF(ROWS($1:1)>DATEDIF($A$1,$A$2,"m")+2-(DAY($A$2)>=DAY($A$1)),"",NETWORKDAYS(MAX($A$1,EOMONTH($A$1,ROWS($1:1)-2)+1),MIN($A$2,EOMONTH($A$1,ROWS($1:1)-1))))

    Regards
    Last edited by XOR LX; 05-23-2014 at 06:25 AM.

  14. #14
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Hi think there has been a bit of a mix up, I will post the sheet and let you see what Is happening. I have adjusted the Months so that they run May To April (our Financial Year) and indicated the year above each month, I need the formula to work with this format.

    Cheers

    JD
    Attached Files Attached Files

  15. #15
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    You haven't even attempted to adapt it. The formula was looking at A1 and A2. Your dates are in B1 and B2.

    The formula in C6 should be:

    =IF(COLUMNS($A:A)>DATEDIF($B$1,$B$2,"m")+2-(DAY($B$2)>=DAY($B$1)),"",NETWORKDAYS(MAX($B$1,EOMONTH($B$1,COLUMNS($A:A)-2)+1),MIN($B$2,EOMONTH($B$1,COLUMNS($A:A)-1))))

    Note that this formula does not depend on the entries above it in rows 4 and 5. Rather, it takes the month/year of the entry in B1, and gives the required days for that month and each following month up to and including the date in B2.

    Regards
    Last edited by XOR LX; 05-23-2014 at 06:25 AM.

  16. #16
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Hi that works brilliantly, thank you, I altered the dates to sit in A1 and A2 previously but it would only come up with 6 in each month, I have just realised that if it was dragged down in would have filled correctly, thank you again for your pateince with this.

    Much appreciated

    JD

  17. #17
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Require a formula to indicate how many days fall within a series of months

    You're welcome!

  18. #18
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Require a formula to indicate how many days fall within a series of months

    Hi thanks for the help that works very well, I previously moved the start and end dates into A1 and A2 but each month displayed 6, I now realise that the formula was to be dragged down and filled that way. Thank you for your pateince on this formula, much appreciated.

    Cheers

    JD

+ 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. Adding Series of Years, Months, & Days
    By jmaitri in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-10-2019, 03:41 AM
  2. [SOLVED] The months that the number of days fall into
    By danfullwood in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 08-28-2013, 10:07 AM
  3. Replies: 7
    Last Post: 03-26-2013, 08:32 AM
  4. days, months and years between todays date and a series of dates
    By jonathanpalmer in forum Excel General
    Replies: 4
    Last Post: 09-22-2010, 03:04 AM
  5. Counting values that fall on certain months
    By wnstar21 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2008, 10:55 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