Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / May 2006

Tip: Looking for answers? Try searching our database.

how do I convert a general number to a time format?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
doveness - 25 May 2006 22:40 GMT
I'm trying to conver 425033 to 42:50:30

I'm running out of steam!
Dave Sheldon - 25 May 2006 22:50 GMT
You can parse the string with
=LEFT(A1,2)&":"&MID(A1,3,2)&":"&RIGHT(A1,2)

Dave

> I'm trying to conver 425033 to 42:50:30
>
> I'm running out of steam!
Pete_UK - 25 May 2006 22:59 GMT
Dave's formula will return a text result which will look like a time.
If you want the result in true Excel time format (numeric) then you
will have to put VALUE( ... ) around his formula and format the cell
using a custom format of [hh]:mm:ss.

Hope this helps.

Pete
Gary''s Student - 25 May 2006 23:09 GMT
Hi Dave:

Good answer.

A slight variation will give a time in standard numerical format:

=LEFT(A1,2)/24+MID(A1,3,2)/(24*60)+RIGHT(A1,2)/(24*60*60)
format as [hh]:mm:ss
Signature

Gary's Student

> You can parse the string with
> =LEFT(A1,2)&":"&MID(A1,3,2)&":"&RIGHT(A1,2)
[quoted text clipped - 4 lines]
> >
> > I'm running out of steam!
gublues - 26 May 2006 00:19 GMT
If you have hrs between 1 and 10 you will have only 5 numbers and only the
RIGHT formula will give correct answer.
Then you have to modify your formula like this:
=IF(LEN(A1)=5;"0"&LEFT(A1;1)&":"&MID(A1;2;2)&":"&RIGHT(A1;2);LEFT(A1;2)&":"&MID(A1;3;2)&":"&RIGHT(A1;2))

if below 1 hrs you maybe have only 4.
Then you have to modify even further:
=IF(LEN(A1)=4;"00"&":"&MID(A1;1;2)&":"&RIGHT(A1;2);IF(LEN(A1)=5;"0"&LEFT(A1;1)&":"&MID(A1;2;2)&":"&RIGHT(A1;2);LEFT(A1;2)&":"&MID(A1;3;2)&":"&RIGHT(A1;2)))

*gublues

Gary''s Student skrev:

> Hi Dave:
>
[quoted text clipped - 13 lines]
> > >
> > > I'm running out of steam!
Gary''s Student - 26 May 2006 00:39 GMT
Your comments are correct.  The formula is designed to handle 6 digit
quantities that can be mapped:  hhmmss

It will fail for hours less than 10.
It will fail for hours greater than 99.

The formula will, however,  handle numbers as per the OP's spec.
Signature

Gary's Student

> If you have hrs between 1 and 10 you will have only 5 numbers and only the
> RIGHT formula will give correct answer.
[quoted text clipped - 26 lines]
> > > >
> > > > I'm running out of steam!
daddylonglegs - 26 May 2006 00:39 GMT
A simpler way.....

=TEXT(A1,"00\:00\:00")+0

format as [h]:mm:ss

Signature

daddylonglegs

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.