Similarly to Engineer's formula:
=IF(B1<A1,B1+1,B1)-A1
where
A1 is departure time
B1 is arrival time.
Excel stores all times & dates in the format
aaaaaa.bbbbbb
where aaaaaa is whole days from an arbitrary starting point (~1 Jan 1900 or thereabouts), and bbbbb is a decimal fraction of a 24 hr 'day' that represents hours, mins & secs.
.5 would be 12 midday, .75 would be 1800 hrs, 1.25 would be the 1 day & 6 hrs after the arbitrary starting date etc.
Mathematically, when a subsequent time occurs after midnight from an initial time then it's really 'plus 1 day' as well as the hours/mins/secs. The problem comes from us using a short version of the date/time group that omits the day. *We* know that the arrival time is the next day and mentally allow for the extra 'day' by calculating time up to midnight + the time from midnight and summing the results, but the spreadsheet has no way of knowing - hence the 'plus 1' in the formula which presumes a smaller number means the arrival time must have crossed midnight.
You could choose to use a date/time group for all time entries then you wouldn't need the formula I gave. Bit of a pain for data entry though.
Last edited by Tinstaafl; 17th December 2004 at 22:20.