Convert Seconds into Hours:Minutes:Seconds

Tyndie

New Member
Joined
Jun 16, 2008
Messages
10
Hi,

Is there an easy way of converting seconds from using a time into hours, minutes, seconds please?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

=A1/86400

and format the result cell as Time. Note that 86400 is the number of seconds in a day (24*60*60).
 
Upvote 0

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Do you wish to apply this to a range of values? ie you have seconds values in A1:A100 that you want converted? In which case record a macro of you performing a PasteSpecial>Operation: Divide on the cells with 86400.
 
Upvote 0

Guanjin Peter

Active Member
Joined
May 21, 2008
Messages
429
range("a1") = range("a1").value / 86400


VOG II: w0w u in singapore?
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Something like this

Code:
Sub test()
Const SecinDay As Long = 86400
Dim iSec As Long, MyTime As Date
iSec = 30000
MyTime = iSec / SecinDay
MsgBox MyTime
End Sub
 
Upvote 0

Tyndie

New Member
Joined
Jun 16, 2008
Messages
10
I am using a timer to calculate the time a macro executes and then the time it executes to be in the status bar, but it shows it in seconds, and the script can run for several hours.
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try this

Code:
Sub test2()
Dim i As Long, t As Date
t = Now
For i = 1 To 100000
    Application.StatusBar = Format(Now - t, "hh:mm:ss")
Next i
Application.StatusBar = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,689
Messages
5,988,032
Members
440,125
Latest member
vincentchu2369

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top