+ Reply to Thread
Results 1 to 2 of 2

Calculate working hours/mins between 2 date/times

  1. #1
    Registered User
    Join Date
    01-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Calculate working hours/mins between 2 date/times

    Hi

    I saw a post from another member 2 days ago asking for the same thing but when I tried the suggested formula it didn't work.

    I have the following date/times in 2 cells (please note the date is dd/mm/yy - I got into all sorts of mess trying to figure out a formula that was based on mm/dd/yy):
    G3: 03/01/12 04:26
    O3: 03/01/12 09:10

    My work day is from 09:00 - 17:30 so I would expect a result of 0:10 for the above example as the start time is outside my working hours. The formula's I have tried are:

    =(NETWORKDAYS(G3,O3)-1)*(17.5/24-9/24)+MOD(O3,1)-MOD(G3,1) which returned a result of 4:44
    =NETWORKDAYS(G3,O3,0)*("17:30"-"09:00") which returned a result of 8:30
    =(NETWORKDAYS(G3,3)-1)*(17.5/24-9/24)+IF(NETWORKDAYS(O3,O3),MEDIAN(MOD(O3,1),17.5/24,9/24),17.5/24)-MEDIAN(NETWORKDAYS(G3,G3)*MOD(G3,1),17.5/24,9/24) which returned a result of ##################

    I'm a fairly novice user of excel so please do bear with me - I have no idea what any of the above mean!

    Please help!

    Also I was just advised to post that the 2 date/times could be within the same day as the example above is or could go over 2 or more days.
    Last edited by MusicSOS; 01-31-2012 at 06:14 AM. Reason: Additional details provided

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,578

    Re: Calculate working hours/mins between 2 date/times

    If B3 is date and time in, C3 is date and time out
    to get total working hrs use this

    =IF(NETWORKDAYS(B3,C3)>0,IF(WEEKDAY(C3,2)<6,MIN("8:00",IF(C3-INT(C3)-"9:00">0,MIN("17:00",C3-INT(C3))-"9:00","0:00")),"00:00")+IF(WEEKDAY(B3,2)<6,MIN("8:00",IF(B3-INT(B3)-"17:00"<0,"17:00"-MAX("9:00",B3-INT(B3)),"0:0")),"00:00")+IF(NETWORKDAYS(B3+1,C3-1)>0,(NETWORKDAYS(B3+1,C3-1)/3),"0:00"),TIME(0,0,0))
    Any clarifications wel come.

+ 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