Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 153
Default TimeValue formula

Hello,

I have a TimeValue formula that works well for hh:mm, but I also need
to expand this to hh:mm:ss, and I've tried several times to get this
right, but can't seem to come up with the proper combination. Here's
the one that works:

=IF(F4="","",IF(F4<1000,TIMEVALUE(LEFT(F4,1)&":"&R IGHT(F4,2)),TIMEVALUE(LEFT(F4,2)&":"&RIGHT(F4,2))) )

With the above formula in F5, if I enter 1234 in cell F4, then in cell
F5 I get 12:34. I need to be able to enter 123456 to get 12:34:56.
Thanks.

Frank
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 623
Default TimeValue formula

To support the entry of seconds, change your formula to:

=IF(F4="","",IF(F4<100000,TIMEVALUE(LEFT(F4,1)&":" &mid(f4,2,2)&":"&RIGHT(F4,2)),TIMEVALUE(LEFT(F4,2) &":"&mid(f4,3,2)&":"&RIGHT(F4,2))))

If you want to support all entries (ie, hmm, hhmm, hmmss, hhmmss), your formula
would be:

=IF(F4="","",IF(F4<1000,TIMEVALUE(LEFT(F4,1)&":"&R IGHT(F4,2)),if(f4<10000,TIMEVALUE(LEFT(F4,2)&":"&R IGHT(F4,2)),IF(F4<100000,TIMEVALUE(LEFT(F4,1)&":"& mid(f4,2,2)&":"&RIGHT(F4,2)),TIMEVALUE(LEFT(F4,2)& ":"&mid(f4,3,2)&":"&RIGHT(F4,2))))))

It's ugly but it works.

Regards,
Fred


"Phrank" wrote in message
...
Hello,

I have a TimeValue formula that works well for hh:mm, but I also need
to expand this to hh:mm:ss, and I've tried several times to get this
right, but can't seem to come up with the proper combination. Here's
the one that works:

=IF(F4="","",IF(F4<1000,TIMEVALUE(LEFT(F4,1)&":"&R IGHT(F4,2)),TIMEVALUE(LEFT(F4,2)&":"&RIGHT(F4,2))) )

With the above formula in F5, if I enter 1234 in cell F4, then in cell
F5 I get 12:34. I need to be able to enter 123456 to get 12:34:56.
Thanks.

Frank



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 153
Default TimeValue formula

Thanks VERY much Fred!

Frank

On Tue, 19 Sep 2006 22:31:18 -0600, "Fred Smith"
wrote:

To support the entry of seconds, change your formula to:

=IF(F4="","",IF(F4<100000,TIMEVALUE(LEFT(F4,1)&": "&mid(f4,2,2)&":"&RIGHT(F4,2)),TIMEVALUE(LEFT(F4,2 )&":"&mid(f4,3,2)&":"&RIGHT(F4,2))))

If you want to support all entries (ie, hmm, hhmm, hmmss, hhmmss), your formula
would be:

=IF(F4="","",IF(F4<1000,TIMEVALUE(LEFT(F4,1)&":"& RIGHT(F4,2)),if(f4<10000,TIMEVALUE(LEFT(F4,2)&":"& RIGHT(F4,2)),IF(F4<100000,TIMEVALUE(LEFT(F4,1)&":" &mid(f4,2,2)&":"&RIGHT(F4,2)),TIMEVALUE(LEFT(F4,2) &":"&mid(f4,3,2)&":"&RIGHT(F4,2))))))

It's ugly but it works.

Regards,
Fred


"Phrank" wrote in message
.. .
Hello,

I have a TimeValue formula that works well for hh:mm, but I also need
to expand this to hh:mm:ss, and I've tried several times to get this
right, but can't seem to come up with the proper combination. Here's
the one that works:

=IF(F4="","",IF(F4<1000,TIMEVALUE(LEFT(F4,1)&":"&R IGHT(F4,2)),TIMEVALUE(LEFT(F4,2)&":"&RIGHT(F4,2))) )

With the above formula in F5, if I enter 1234 in cell F4, then in cell
F5 I get 12:34. I need to be able to enter 123456 to get 12:34:56.
Thanks.

Frank


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM


All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"