Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert Decimal to Time


I want to convert 0.453240 into an hh:mm:ss:ss time.

How do I do this?


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=492291

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Convert Decimal to Time

Just format the cell as Time, then select the format you require.

Pete

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Convert Decimal to Time

Hi,


If A1 contains 0.453240 then in VBA

Range("B1") = Format(Range("A1"), "hh:mm:ss")

or format cell B1 to be "hh:mm:ss" and in B1 put '=A1' (no quotes)

"oberon.black" wrote:


I want to convert 0.453240 into an hh:mm:ss:ss time.

How do I do this?


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=492291


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert Decimal to Time


Hello oberon.black,

Excel only tracks time down to a 1 second interval. The decimal portion
of the Time value is the number of seconds from Midnight. There are
86400 seconds in a 24 hour day. The example given is for the worksheet
using coulmn "A". A1 contains the value 0.453240.

EXAMPLE:

'Time in seconds since Midnight
A1 0.453240

'Convert from decimal to integer
A2 =A1*100000

'Calculate Hours
A3 =INT(A2/3600)

'Calculate Minutes
A4 =INT(MOD(A2, 3600)/60)

'Calculate Seconds
A5 =MOD(A2, 3600) - (A4*60)


Sincerly,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=492291

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
convert time to decimal doodle302 Excel Worksheet Functions 2 January 13th 10 06:20 PM
convert time into decimal Richard[_2_] New Users to Excel 4 March 25th 07 06:35 PM
convert decimal to time ganga Excel Discussion (Misc queries) 3 March 2nd 07 11:14 PM
How to convert time to decimal frankie New Users to Excel 1 May 24th 06 04:44 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM


All times are GMT +1. The time now is 01:18 PM.

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

About Us

"It's about Microsoft Excel"