Convert 100 to 0100

rdstagg

New Member
Joined
Oct 29, 2003
Messages
44
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
 

Some videos you may like

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
Joined
Mar 10, 2004
Messages
19,467
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
Joined
Mar 27, 2003
Messages
442
Try applying a format? Format/Cells, you want either hhmm or hh:mm
 

rdstagg

New Member
Joined
Oct 29, 2003
Messages
44
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.
 

Watch MrExcel Video

Forum statistics

Threads
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.
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