View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Need formula for calculating time

"wjl408" wrote:
I need some help on a excel program I am making for our duty
and flight times for the FAA. I need the calculation for time
and then convert it to tenths. Example Start Off On Off times
as entered onto the flight logs, if your start is 0800 off
0815 on 0915 shutdown 0922 your block to block is 0122 which
would be flight time according to the FAA and would be 1.4 hrs.


I am not familiar with FAA rules for recording flight times. Based on your
description above, try:

=ROUND((TEXT(A4,"00\:00")-TEXT(A1,"00\:00")+(A1A4))*24,1)

where A1 is the "start" time and A4 is the "shutdown" time. The interim
"off" and "on" times seem irrelevant, according to your example.

The factor +(A1A4) accounts for the case where "start" and "shutdown" times
span midnight.

But that only works when "start" and "shutdown" times are no more than 24
hours apart.

Explanation....

For Excel, time is usually entered in the form hh:mm. So TEXT(A4,"00\:00")
converts the form hhmm to hh:mm. Caveat: Regional differences might apply.
See the Time Separator in the Regional and Language Options control panel
(in Win XP).

Excel time (hh:mm) is actually represented by a number composed of integer
days and time as a fraction (h/24 + m/1440 + s.sss/86400). So multiplying
the time difference by 24 converts to Excel time to a decimal number of
hours.

When A1A4 is true, and A1 and A4 are within 24 hours, the time difference
is negative. In that case, we want to add 1 day (24 hours) to calculate the
elapsed time. Since (A1A4) is TRUE, +(A1A4) is treated as +1.

Rounding to 1 decimal place ensures that arithmetic result is "exactly"
accurate to 1 decimal places. This might not be necessary, depending on FAA
rules. It might be sufficient, perhaps even preferred, to remove the
ROUND(...,1) part, calculate the time difference exactly, and simply use the
format Number with 1 decimal place to cause the actual value to be
__displayed__ rounded to 1 decimal place.