Time Conversion

fallof89

New Member
Joined
May 11, 2016
Messages
8
I have been attempting to convert numbers such as '080952' to 08:09:52 am. I have tried time conversion by formatting cells, and when I do I receive 0 or 12:00am.

I have used the following formula:

=TIME(VALUE(LEFT(B2,2)),VALUE(MID(B2,3,2)),VALUE(RIGHT(B2,2)))

and it works well for the most part, but there are cells that aren't converted properly.


I also tried to format the cells initially to ensure six digits, from '42515' (4:25:15 am) to '042515' to see if this would help and it didn't. I'm sure I'm missing something.

Please help.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
That actually worked. Thanks Weazel. Not to sound ungrateful, but is it possible to add am/pm? If not, no biggie.
 
Upvote 0
you should be able to have the AM/PM with regular formatting

if you select the cell and press control 1....Number....Time....then select the format you want the time in
 
Upvote 0
This might work for you.
A1 : 080952 [format as text]
A2 : =INT(LEFT(A1,2)) [format as number]
A3 : =IF(A2<12,"AM","PM")

Result : =TEXT(A1,"00\:00\:00")&" "&A3 [format as time]
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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