View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Huge problem with time

I not sure if your time is in hours or days. But the code below should get
your answer. I find the only way to get hours when they are greater than 24
is to use the last line of the code below (or similar). You have to count the
number of days and multiply by 24 then add to the number of hours. You need
to use the format statement to make sure you have a two digit number of
minutes. Nobody like to see 6:2 when we are use to 6:02.

TimeDays = 34.875
WholeDays = Int(TimeDays)
FractDays = TimeDays - WholeDays
Hours = Hour(FractDays) + (24 * WholeDays)
TextTime = Hours & ":" & Format(Minute(FractDays), "#00")

"Marco" wrote:

hello. I have a problem here which I don't know that can be solved.

I need to transform some decimals to time and in another column know the
time in days.

I have this e columns:
34 0,875 34,875

if I divide by 24 and format as time I have this:
10:00 0:52 10:52

The problem is when the sum is bigger then 24 hours, so I have this:
0,13 0,91 1,04

And is show me this:
3:00 21:52 0:52

and I need this:
3:00 21:52 24:52

But if I format all column with this format: [h]:mm:ss;@

In the first example I have get this:
10:00 0:52 34:52:30

How can I fix this?


Thanks,
Marco