+ Reply to Thread
Results 1 to 7 of 7

NETWORKDAYS formula CHECK!! Please

  1. #1
    Registered User
    Join Date
    02-18-2015
    Location
    Detroit, Michigan
    MS-Off Ver
    2010
    Posts
    4

    NETWORKDAYS formula CHECK!! Please

    Hi all,

    First time user, short term lurker! I'm not sure if this is the right place or not but I'd like to get a formula check as a solution to the following issue:

    I'm trying to sum the total number of networkdays and hours (so totaling only those days; hours that fall between monday - friday), between two date:time filled columns in Excel 2010.

    I've run through the search function and found 'daddylonglegs' has answered this question a few times before (just y'know, once or twice.. but I want to make sure MY work around is applicable to MY situation (I'm a special snowflake dammit.)

    Given A2 Contains the Start Date & Time
    and B2 Contains the End Date & Time

    Please also note that this data cannot have an End Date & Time that comes before a Start Date & Time (Step 2 cannot happen before step 1's completion)

    So then the summation formula would be...

    =IF(NETWORKDAYS(A2,B2)-1 =0, mod(B2,1)-mod(A2,1),(NETWORKDAYS(A2,B2)-1)+MOD(B2,1)-MOD(A2,1)))

    Look familiar?

    Anyway, I added in the IF statement to make sure I capture just the hours between Start Date and End Date --- if the Start Date & Time and End Date & Time are on the same day (happens quite a bit within my data set).

    Please advise!

    Thanks all and I hope to become a very active member on these boards!

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

    Re: NETWORKDAYS formula CHECK!! Please

    You shouldn't need the IF function

    If the start and end dates are always Monday to Friday it's sufficient to use this version

    =NETWORKDAYS(A2,B2)-1+MOD(B2,1)-MOD(A2,1)

    That will work, even if A2 and B2 are on the same day

    .......or do you have start/end dates on weekends?
    Audere est facere

  3. #3
    Registered User
    Join Date
    02-18-2015
    Location
    Detroit, Michigan
    MS-Off Ver
    2010
    Posts
    4

    Re: NETWORKDAYS formula CHECK!! Please

    Hiya DLL!

    Thank you for your quick response!

    I looked over the data and found a few Start/ End dates that occur on Sat/Sun... AND my previous formula forgot to account for Holidays between Start and End dates. (my bad!)

    So basically these dates & times are usually created during the work week, with a few exceptions...

    So how do I utilize the networkdays.intl function while accounting for Sat/Sun start/end dates??

    Thank you for your time!

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

    Re: NETWORKDAYS formula CHECK!! Please

    This version will only count MF, non-holiday time, and allows start/end times to be any time (even on a holiday) - assuming holiday dates in H2:H10

    =NETWORKDAYS(A2,B2,H$2:H$10)+NETWORKDAYS(B2,B2,H$2:H$10)*(MOD(B2,1)-1)-NETWORKDAYS(A2,A2,H$2:H$10)*MOD(A2,1)

  5. #5
    Registered User
    Join Date
    02-18-2015
    Location
    Detroit, Michigan
    MS-Off Ver
    2010
    Posts
    4

    Re: NETWORKDAYS formula CHECK!! Please

    Wow! Thanks, DLL!

    So if I'm reading this correctly the first portion of the formula will calculate the NETWORKDAYS: M:F, given non-holiday time; the second part calculates the hour difference between the end date's hours and the start date's hours..

    Awesome!! But quick question.. what if the end date hours are earlier than the start date hours? Say it was ordered at 3pm, and delivered at 8 am - wouldn;t the serial number for 8am be less than the 3pm causing it to subtract time?

    Also, should it include a final -1 to remove the instances when A2 and B2 are the same day and counted as 2 by the first part of the formula?

    Sorry about all the questions, but I like to know what I'm incorporating!!! Either way thank you SO much for your help!

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

    Re: NETWORKDAYS formula CHECK!! Please

    Quote Originally Posted by coded View Post
    .. what if the end date hours are earlier than the start date hours? Say it was ordered at 3pm, and delivered at 8 am - wouldn;t the serial number for 8am be less than the 3pm causing it to subtract time?
    Yes, but in that scenario the 8 AM delivery must be on a later date so you will get a negative time value subtracted from a whole number of days, e.g. if the date was next working day you'd get 1 day (24:00) - 3PM (15:00) + 8 AM (8:00) and that sums to 17:00 which is the correct number of hours

    Quote Originally Posted by coded View Post
    Also, should it include a final -1 to remove the instances when A2 and B2 are the same day and counted as 2 by the first part of the formula?
    Yes, the -1 is still there as per the first formula I suggested but it's now incorporated in the (MOD(B2,1)-1) part, so for same (working) day the first NETWORKDAYS gives you 1 and then the -1 sets that back to zero and you effectively just get the time difference.

    The formula should work for any time range as long as B2 > A2 - If you have holiday dates to exclude you can do that too by inserting the holiday range in each of the NETWORKDAYS functions

  7. #7
    Registered User
    Join Date
    02-18-2015
    Location
    Detroit, Michigan
    MS-Off Ver
    2010
    Posts
    4

    Re: NETWORKDAYS formula CHECK!! Please

    Amazing!! Thank you, DLL!!!

    You rock!

+ 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. [SOLVED] Networkdays formula
    By gtudor in forum Excel General
    Replies: 14
    Last Post: 05-03-2012, 10:49 AM
  2. Networkdays formula
    By JezLisle in forum Excel General
    Replies: 5
    Last Post: 11-04-2010, 06:00 AM
  3. Is there a faster way to check holidays NETWORKDAYS() replacement
    By squiggler47 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2009, 12:27 PM
  4. NETWORKDAYS FORMULA
    By Lichase in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. [SOLVED] NETWORKDAYS FORMULA
    By Lichase in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2005, 05:05 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