calculating difference in time

G

Guest

how do we calculate the amount of time between two set times? for example,
d2 as time of 10pm and b2 has time of 7am. do we need to have the column
formatted as a time or number? Or is there a specific calc we need?

Help please
 
D

David Biddulph

=MOD(D2-B2,1), and format as [h]:mm
The MOD() formula allows for times running over midnight, so if you wanted
to work out the time from 10pm to 7am, =MOD(B2-D2,1) would do it for you.
If you want to convert to decimal hours, =24*MOD(B2-D2,1), and format as
number or general, not time.

You'll have to make sure you enter 7 am with the space, as 7am without a
space will be treated as text. Similarly with the pm.
 
G

Guest

Hi,

You don't say which is the earlier time so the difference could be 3 hrs or
21 hrs:)

This formula will work it out the difference with the earlier time in B2

=IF(B2>D2,D2+1-B2,D2-B2)

Use a custom format of hh:mm

Mike
 
D

David Biddulph

9 or 15, not 3 or 21, Mike?
--
David Biddulph

Mike H said:
Hi,

You don't say which is the earlier time so the difference could be 3 hrs
or
21 hrs:)

This formula will work it out the difference with the earlier time in B2

=IF(B2>D2,D2+1-B2,D2-B2)

Use a custom format of hh:mm

Mike
 

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