+ Reply to Thread
Results 1 to 9 of 9

Finding the number of days a range contains within a month

Hybrid View

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    Alabama
    Posts
    25

    Finding the number of days a range contains within a month

    I have a column with a start date and another with a finish date for each row. I have columns to the right of that with headers for each month. I want a formula to tell me how many working days are contained in that range of start to finish in each month. Below is an example where I manually entered the answer I need excel to find with the formula. I need this to take out the holidays as well. Please help!
    Attached Files Attached Files

  2. #2
    Spammer
    Join Date
    12-01-2011
    Location
    https://t.me/pump_upp
    MS-Off Ver
    Excel 2003:2010
    Posts
    14

    Re: Finding the number of days a range contains within a month

    Take a look at NETWORKDAYS formula

  3. #3
    Registered User
    Join Date
    10-15-2008
    Location
    Alabama
    Posts
    25

    Re: Finding the number of days a range contains within a month

    I've got that part, I just can't figure out how to make it pull from only one month within that range.

  4. #4
    Spammer
    Join Date
    12-01-2011
    Location
    https://t.me/pump_upp
    MS-Off Ver
    Excel 2003:2010
    Posts
    14

    Re: Finding the number of days a range contains within a month

    enter this formula in d2 then drag down and across, after you have specified the range for [holidays]

    =IF(MONTH(D$1)<MONTH($B2),0,IF(MONTH(D$1)>MONTH($C2),0,NETWORKDAYS(MAX(D$1,$B2),MIN(EOMONTH(D$1,0),$C2),[holidays])))

  5. #5
    Registered User
    Join Date
    10-15-2008
    Location
    Alabama
    Posts
    25

    Re: Finding the number of days a range contains within a month

    The formula works except where I'm going from one year into the next, then when I evaluate it comes up N/A when you see if the column date is greater than the finish date. I edited the attachment to show you the actual sheet
    Attached Files Attached Files
    Last edited by britt@wjg; 05-17-2012 at 03:11 PM.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Finding the number of days a range contains within a month

    Remove the MONTH function from the inequalities and it should work. Here's the formula I used. Holiday is a named range where your holiday dates are.

    =IF(D$1<$B2,0,IF(D$1>$C2,0,NETWORKDAYS(MAX(D$1,$B2),MIN($C2,DATE(YEAR(D$1),MONTH(D$1)+1,0)),Holidays)))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    10-15-2008
    Location
    Alabama
    Posts
    25

    Re: Finding the number of days a range contains within a month

    This does not work either, now it "True"'s out to a value of zero on the greater than function.

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

    Re: Finding the number of days a range contains within a month

    This should also work

    =MAX(0,NETWORKDAYS(MAX(L$1,$E35),MIN(EOMONTH(L$1,0),$F35)))*$J35
    Audere est facere

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

    Re: Finding the number of days a range contains within a month

    Did you try my version? In L2 copied across and down

    =MAX(0,NETWORKDAYS(MAX(L$1,$E2),MIN(EOMONTH(L$1,0),$F2)))*$J2

    include holiday range here

    =MAX(0,NETWORKDAYS(MAX(L$1,$E2),MIN(EOMONTH(L$1,0),$F2),holidays))*$J2
    Last edited by daddylonglegs; 05-17-2012 at 04:04 PM.

+ 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