Convert 6 digit number into hh:mm:ss format

kwatts83

New Member
Joined
Oct 27, 2017
Messages
1
I would like to type a 6 digit number (i.e. 070144) into a cell and have it read as 07:01:44 in that cell. Is this possible? I am not looking to create a formula in a different cell. I just want to type the number and have it show up with the colons in between.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to the board..

It will require VBA code.
This will apply only to column A
Right click the Sheet's Tab, View Code
Paste the following
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range, c As Range
Set MyRange = Intersect(Target, Range("A:A"))
On Error GoTo Handlr
If Not MyRange Is Nothing Then
    Application.EnableEvents = False
    For Each c In MyRange
        c.Value = Format(c.Value, "00\:00\:00")
        c.NumberFormat = "hh:mm:ss"
    Next c
End If
Handlr:
Application.EnableEvents = True
End Sub
 
Upvote 0
I would like to type a 6 digit number (i.e. 070144) into a cell and have it read as 07:01:44 in that cell. Is this possible? I am not looking to create a formula in a different cell. I just want to type the number and have it show up with the colons in between.
If you don't need that number to ever be a real time value (which looks to be the case given your first number is 70), you can simply custom format your cell using this Type format pattern..

00\:00\:00
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,287
Messages
6,184,076
Members
453,210
Latest member
GravyG_123

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
Back
Top