Adding 24hr times

philrobbo

New Member
Joined
Feb 25, 2013
Messages
14
I am trying to calculate some 24hr times. This is what I have.
I have 4 x times. Start (a), finish (b),2nd start (c) and 2nd finish (d)

If the time difference between b and c is 20mins or less I want e = a + d
If the time difference is greater than 20 mins e = (a + b) +(c + d)

The answer I am looking for is the difference in times. ie 1530 +1545 = 0.15

Please help
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
what you actually want then is
e=d-a if c-b<=20 or
e=(b-a)+(d-c) if c-b>20
in formula form, if the times are in A1 trough D1 then in E1:
=IF(C1-B1<=20/(24*60),(D1-A1)*24,((B1-A1)+(D1-C1))*24)

This result is in hours.
 
Upvote 0
It worked for me with basic testing. Can you give an example of a set of times that failed?
Do your times perhaps extend over a day (i.e. start time prior to midnight one day and finish the next day)? If so there's a couple of changes needed.
 
Upvote 0

Forum statistics

Threads
1,196,368
Messages
6,014,864
Members
441,851
Latest member
Cheeseballs99

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top