Calculating time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I calculate normal numbers that have been entered as say 1.15 (1hr 15min) and 2.55 (2hr 55min). I want add these two up but indicate as hour calculation rather than normal numerical calculation. I know you should use the Time/Date format but I had chosen the number format when setting up as some times hours of 35+ need to be entered - which the Time/Date format does not accept.

Please help.
 
You can use the following as it will convert the number from text to Double
Data Type should the number be in String format (Text).

Dim Hour as Long, Minute as Long, Time1 as Double, Remainder as Double
Dim Time2 as Double, TotalTime as Double

Time1 = CDbl(Textbox1.Value)
Time2 = CDbl(Textbox2.Value)
Hour = Int(Time1)
Minute = Int((Time1-Hour)*100)
TotalTime = Hour
Hour = Int(Time2)
Minute = Int((Time2-Hour)*100)+Minute
TotalTime = TotalTime + Hour + Int(Minute/60) + (Minute mod 60)/100

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

gulam said:
How can I calculate normal numbers that have been entered as say 1.15 (1hr
15min) and 2.55 (2hr 55min). I want add these two up but indicate as hour
calculation rather than normal numerical calculation. I know you should use
the Time/Date format but I had chosen the number format when setting up as
some times hours of 35+ need to be entered - which the Time/Date format does
not accept.
 
Back
Top