Calculating time differences through midnight


Posted by David Price on July 07, 2001 1:47 PM

I am trying to calculate the length of a shift if it goes through midnight. I need the same formula to work on both days and night shifts.
My day shift formula is a simple sum(A1-A2)
The night shift formula is sum(24-A1)+(A2)-23
without that "-23" on the end my totals figure ended up with an extra 552
How do I write into a formula the time midnight? Obviously my 24 refers to days and when I write 24:00 or 00:00 it does not recognize it.

Posted by Aladin Akyurek on July 07, 2001 2:41 PM

Try instead:

=(A2+(A2 < A1)-A1

where A2 is end of shift and A1 start of shift.

Aladin



Posted by David Price on July 07, 2001 3:06 PM


Thanks soooo much. It works perfectly.