View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How do I calculate the difference between 11:00pm and 7:00am

Hi,


I have no idea what you have in G1 or H16, you don't tell us but to work
with time over midnight your formula converts to this

=IF((E16-D16+(E16<D16))*245,H16-G1,E16-D16)


It this bit that calculates the difference between 2 times over midnight
E16-D16+(E16<D16)

Mike

"candros" wrote:

I'm working on a time card and have three shifts. The start and end time are
formated to time, the cell with the formula is formated as [h]:mm, the
formula I'm using is
IF(TEXT(E16-D16,"h:mm")"5:00",H16-$G$1,TEXT(E16-D16,"h:mm"))
this works for day's and afternoon shifts but will not work for the midnight
shift from 10:30pm to 7:00am. I'm also calculating two different way's
depending on if the shift is over 5 hours. What formula do I need to use to
cover the midnight shift.