How to calculate a Time Difference

D

dwalsh77

I currently am looking to be able to subtract two times (using the 24 hour
clock), where the result is a Decimal. For example. I leave at 14:00 and
arrive at 17:30. Thats a difference of 3.5 hours. I believe I have this
solved with the following formuals:

=(C2-INT(C2))*24-(B2-INT(B2))*24 (WHERE C2 is the arrival time and B2 is
the DEPARTURE Time).

My problem is that if you leave at 23:30 and don't arrive until 03:30, then
it gives me a large negative number instead of 4.0 hours.

Any ideas?

Thanks,
 
J

James R-S

Assuming that we're only dealing with times (and not dates) use this:

=MOD(A1-B1,1) or =MOD(R1C1-R1C2,1)

Simple.

James R-S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top