+ Reply to Thread
Results 1 to 2 of 2

date and time calculations

Hybrid View

Pjcan1 date and time calculations 02-17-2011, 06:31 AM
DonkeyOte Re: date and time calculations 02-17-2011, 07:25 AM
  1. #1
    Registered User
    Join Date
    06-14-2005
    Location
    London
    MS-Off Ver
    2016
    Posts
    91

    date and time calculations

    I have four fields in a table:

    Open date - format dd/mm/yy
    Open time - format HH:MM
    Close date - format dd/mm/yy
    Close time - format HH:MM

    I'd like to calculate in the fifth field the difference, in hours, between the open date & time and the close date & time. How am I best to do this?

    Also, if i wanted to apply a working day rule to this (of 09:00 to 18:00) how could I then calculate this in days / hours.

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

    Re: date and time calculations

    The key question is whether or not you need the working day element - if you do then the approach is significantly different.

    Total duration:

    E2:
    =SUM(C2:D2)-SUM(A2:B2)
    format as [h]:mm:ss
    Working Day duration:

    F2:
    =(NETWORKDAYS(A2,C2)-1)*("18:00"-"9:00")+IF(NETWORKDAYS(C2,C2),MEDIAN(D2,"18:00","9:00"),"18:00")-MEDIAN(NETWORKDAYS(A2,A2)*B2,"18:00","9:00")
    format as [h]:mm:ss
    use of NETWORKDAYS pre XL2007 requires activation of the Analysis ToolPak (tools - addins)

    It would be helpful if you specified which version you're running either in post or profile [better] - and also your locale.
    Last edited by DonkeyOte; 02-17-2011 at 07:28 AM. Reason: forgot note re: cumulative format

+ 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