Convert 100 to 0100

rdstagg

New Member
I am trying to convert times.
I am using
=TIME(LEFT(H2,2),RIGHT(H2,2),0)
The only problem I have is the times from 100(1 am) to 900(9am) where I am missing the extra zero at the front.
I know there must be a simple way round this but I can't seem to do it!!

0 = midnight = 00:00
100 = 1am = 01:00
200 = 2am = 02:00 etc

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Domenic

MrExcel MVP
Maybe...

=IF(LEN(A1)=1,TIME(0,0,0),IF(LEN(A1)=3,TIME(LEFT(A1),RIGHT(A1,2),0),TIME(LEFT(A1,2),RIGHT(A1,2),0)))

Hope this helps!

zilpher

Active Member
Try applying a format? Format/Cells, you want either hhmm or hh:mm

rdstagg

New Member
Zilpher - tried that - didn't work
domenic - many thanks -superb piece of work and all resolved in under 30 mins - what a marvellous resource this forum is.

Replies
1
Views
55
Replies
1
Views
128
Replies
17
Views
439
Replies
9
Views
247
Replies
6
Views
75

1,127,875
Messages
5,627,412
Members
416,245
Latest member
Xterminat

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.

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

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