ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   calculating difference in time (https://www.excelbanter.com/excel-discussion-misc-queries/157395-calculating-difference-time.html)

tam25

calculating difference in time
 
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

David Biddulph[_2_]

calculating difference in time
 
=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.
--
David Biddulph

"tam25" wrote in message
...
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




Mike H

calculating difference in time
 
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(B2D2,D2+1-B2,D2-B2)

Use a custom format of hh:mm

Mike



"tam25" wrote:

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


David Biddulph[_2_]

calculating difference in time
 
9 or 15, not 3 or 21, Mike?
--
David Biddulph

"Mike H" wrote in message
...
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(B2D2,D2+1-B2,D2-B2)

Use a custom format of hh:mm

Mike


"tam25" wrote:

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




Mike H

calculating difference in time
 
it's early :)

"David Biddulph" wrote:

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

"Mike H" wrote in message
...
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(B2D2,D2+1-B2,D2-B2)

Use a custom format of hh:mm

Mike


"tam25" wrote:

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






All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com