+ Reply to Thread
Results 1 to 9 of 9

NETWORKDAY issue

  1. #1
    Registered User
    Join Date
    01-13-2009
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    7

    NETWORKDAY issue

    At present I have a spreadsheet that brings back the start date of an incident, and the end date of incident. Subtracting one from the other gives the time taken on the incident, but if it runs over a weekend that distorts the tiem taken. Is there a way to give the tiem taken for an incident in days, hours and so on?

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Welcome to the forum, if you want to include week-ends and have your date/time in
    A1=01/01/2009 15:00:00
    B1=13/01/2009 19:23:00
    C1=INT(B1-A1) &" Days " & INT(MOD(B1-A1,INT(B1-A1))*24) & " Hours and " &MINUTE(B1-A1) & " Minutes"
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    or

    C1: =B1-A1
    C1: Custom Format = d "Days" h "Hours" m "Minutes"

    Though I'm not entirely sure we answering your question... could you provide some examples of your values and intended results ?

  4. #4
    Registered User
    Join Date
    01-13-2009
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    7
    I'm trying to omit the weekends, so it's only counting the workdays

    The example I have from 02/01/2009 09:26 to 05/01/2009 08:12

    Which, if you count the weekend is nearly 3 days, but I just need the workdays, so take the weekend out where necessary

    Thanks again

  5. #5
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    Hi,

    Have you tried using NETWORKDAYS function available with Analysis Tool Pak.



    For more detail.. Type NETWORKDDAYS in excel help window

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Networkdays won't obviously give you the duration in hours etc... for that you need to do some additional work with the NETWORKDAYS function:

    =(NETWORKDAYS(A1,B1)-1)+(MOD(B1,1)-MOD(A1,1))

    where A1 & B1 hold start & end datetime values respectively and holidays is an optional named range containing public holiday dates that are to be excluded from the calculation also.

    note the above would not work were the start/end dates to fall on weekends/public holidays.

    you can format the result as detailed previously to give duration in the requisite format.

    check out daddylonglegs posts' on all things NETWORKDAY... you're bound to find a solution that works for you amongst that little goldmine of information...

  7. #7
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    If you know the no. of days...

    You can easily convert it into hour -- days * 24 and minutes days * 24 * 60 and seconds days * 24 * 60 * 60

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    I'm afraid this is not the case:

    If as per OP ex.:

    A1: Start: Friday 2nd Jan 09:26
    B1: End: Monday 5th Jan 08:12

    NETWORKDAYS(A1,B1) returns 2 as it is inclusive of both dates - ie Friday & Monday are both working days. So firstly you need to discount 1 day.

    If you do that and * 24 you're saying 24 hours have passed which is not correct.

    The amount of time that has passed is:

    09:26 to Midnight on Friday + 8 hours & 12 minutes on Monday.

    The correct result is therefore essentially:

    (1-TIME(9,26,0))+TIME(8,12,0) -> ie 22 hrs 46 mins.

    Or another way - 1 day less the difference in time between 9:26 and 8:12 -> 1 day - 1 hour and 14 mins.

  9. #9
    Registered User
    Join Date
    01-13-2009
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    7
    Quote Originally Posted by DonkeyOte View Post
    Networkdays won't obviously give you the duration in hours etc... for that you need to do some additional work with the NETWORKDAYS function:

    =(NETWORKDAYS(A1,B1)-1)+(MOD(B1,1)-MOD(A1,1))

    where A1 & B1 hold start & end datetime values respectively and holidays is an optional named range containing public holiday dates that are to be excluded from the calculation also.

    note the above would not work were the start/end dates to fall on weekends/public holidays.

    you can format the result as detailed previously to give duration in the requisite format.

    check out daddylonglegs posts' on all things NETWORKDAY... you're bound to find a solution that works for you amongst that little goldmine of information...
    This has done exactly what I wanted, fantastic

+ 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