ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   time clock wrap around midnight (https://www.excelbanter.com/excel-worksheet-functions/141010-time-clock-wrap-around-midnight.html)

BillO

time clock wrap around midnight
 
Hi

For example I have two times entered as 23:30 and 1:45 (but the next day) we
are not entering the date just the time. Subtracting the two gets the
correct answer but when the times wrap around midnight (as above) then there
is a negative time difference and it is wrong.

How can I keep entering just the basic time (without date) and take the
difference and make this difference work around midnight?

thanks

Peo Sjoblom

time clock wrap around midnight
 
With start time in A1 and end time in B1


=B1-A1+(B1<A1)

or

=MOD(B1-A1,2)

don't forget to format result as time

--
Regards,

Peo Sjoblom



"BillO" wrote in message
...
Hi

For example I have two times entered as 23:30 and 1:45 (but the next day)
we
are not entering the date just the time. Subtracting the two gets the
correct answer but when the times wrap around midnight (as above) then
there
is a negative time difference and it is wrong.

How can I keep entering just the basic time (without date) and take the
difference and make this difference work around midnight?

thanks




JE McGimpsey

time clock wrap around midnight
 
One way:

=MOD(B1-A1,1)

formatting as time.

Alternatively,

=B1-A1+(A1<B1)

In article ,
BillO wrote:

Hi

For example I have two times entered as 23:30 and 1:45 (but the next day) we
are not entering the date just the time. Subtracting the two gets the
correct answer but when the times wrap around midnight (as above) then there
is a negative time difference and it is wrong.

How can I keep entering just the basic time (without date) and take the
difference and make this difference work around midnight?

thanks


JE McGimpsey

time clock wrap around midnight
 
Oops, switch that

=B1-A1+(B1<A1)

In article ,
JE McGimpsey wrote:

=B1-A1+(A1<B1)



All times are GMT +1. The time now is 02:32 AM.

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