+ Reply to Thread
Results 1 to 5 of 5

How do I calculate time between 2 dates/times subtracting the time over weekends?

  1. #1
    bugmenot
    Guest

    How do I calculate time between 2 dates/times subtracting the time over weekends?

    I have 2 cells that I want to find the amount of time between (d:hh:mm)

    My dates are formated like this: Saturday January 24, 2009 12:11PM (DayofWeek mmmm,dd,yyyy hh:mm AM/PM)

    The catch is that if the times span over a weekend, I don't want to include the 48H of the weekend?

    ie. If I have:
    Date #1: Friday, Jan 23, 2009 4:00 PM
    Date #2: Tuesday Jan 27, 2009 2:00PM

    Would normally be: 190h

    But I want to automatically subtract the 48h of the weekend whenever this occurs

    Thus the answer I want is: 142h

    I have a few hundred of these and want to be able to figure it out - any help would be greately appreciated

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    use the =NETWORKDAYS() function its designed for just that
    http://support.microsoft.com/kb/259200

  3. #3
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Time arithmetic

    Hi

    Try this page on C Pearsons site which goes into what you want in detail.
    HTML Code: 
    Regards

    Jeff

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    I'd say there are 94 hours between those 2 timestamps, when you take off 48 hours over the weekend the result would be 46

    If start time/date is in A1 and end time/date in B1 then try this formula in C1

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

    format C1 as [h]:mm to give result 46:00

    If you want the result as a decimal, i.e. 46 then multiply by 24 i.e.

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

    format as number

    In either case I'm assuming that start and end times will always be on weekdays. If that isn't the case, i.e. if start and end dates could be at the weekend then you need a slightly more complex formula.....

  5. #5
    Registered User
    Join Date
    08-17-2008
    Location
    Worthing, Sussex, UK.
    Posts
    46
    Quote Originally Posted by bugmenot View Post
    I have 2 cells that I want to find the amount of time between (d:hh:mm)

    My dates are formated like this: Saturday January 24, 2009 12:11PM (DayofWeek mmmm,dd,yyyy hh:mm AM/PM)

    The catch is that if the times span over a weekend, I don't want to include the 48H of the weekend?
    Hi.

    I hope this helps, but attached is a modified version of an existing sheet I use. It's been sanatised from data, there is normally 5 Weekly sheets per book and each sheet is 400 rows down, not just 16. You will have to play with the formula to make it record hours, but the M and N columns are what you are looking at.
    Attached Files Attached Files
    Last edited by cheesysocks; 01-26-2009 at 06:43 AM.
    Best regards,
    Mike.

+ 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