+ Reply to Thread
Results 1 to 11 of 11

Calculate Time Duration

Hybrid View

T86157 Calculate Time Duration 05-31-2012, 01:27 PM
Ricker090 Re: Calculate Time Duration 05-31-2012, 02:01 PM
tigeravatar Re: Calculate Time Duration 05-31-2012, 02:17 PM
tigeravatar Re: Calculate Time Duration 05-31-2012, 02:33 PM
daddylonglegs Re: Calculate Time Duration 05-31-2012, 02:57 PM
T86157 Re: Calculate Time Duration 05-31-2012, 03:11 PM
daddylonglegs Re: Calculate Time Duration 05-31-2012, 03:16 PM
T86157 Re: Calculate Time Duration 05-31-2012, 02:37 PM
Ricker090 Re: Calculate Time Duration 05-31-2012, 02:39 PM
tigeravatar Re: Calculate Time Duration 05-31-2012, 03:21 PM
T86157 Re: Calculate Time Duration 05-31-2012, 03:25 PM
  1. #1
    Forum Contributor
    Join Date
    05-17-2012
    Location
    CA, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    163

    Re: Calculate Time Duration

    Quote Originally Posted by daddylonglegs View Post
    Perhaps there won't be any times around midnight but what if C5 = 12.3 and D5 = a signifying half past midnight, that formula treats the time like 12:30 PM

    I suggest this version

    =((TEXT(E5*100,"0\:00 ")&F5)-(TEXT(C5*100,"0\:00 ")&D5))*24
    You do provide a good point about 12:30am for C5 and D5. That just made me realize something else. If C5=11.3 and D5=p while E5=1.3 and F5=a, it provides the hours "owed" instead of the actual hours. Not, that I couldn't solve this but there is probably a more efficient way than formulating it with an if function similar to the one shown below...

    =IF((((TEXT(E11*100,"0\:00 ")&F11)-(TEXT(C11*100,"0\:00 ")&D11))*24)<0,(((TEXT(E11*100,"0\:00 ")&F11)-(TEXT(C11*100,"0\:00 ")&D11))*24)+24,(((TEXT(E11*100,"0\:00 ")&F11)-(TEXT(C11*100,"0\:00 ")&D11))*24))
    Basically if the value is negative, it adds 24 hours to make it correct or leaves it as is if the difference is already positive. It seems a bit redundant the way I did it...

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

    Re: Calculate Time Duration

    Quote Originally Posted by T86157 View Post
    If C5=11.3 and D5=p while E5=1.3 and F5=a, it provides the hours "owed" instead of the actual hours.
    So the answer for that example should be 2? Try this modified version of my suggestion

    =MOD((TEXT(E5*100,"0\:00 ")&F5)-(TEXT(C5*100,"0\:00 ")&D5),1)*24
    Audere est facere

+ 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