Time conversion

JoboM

New Member
Joined
May 26, 2015
Messages
40
Hi there gurus!

I'm trying to convert a general entry into a cell into a time format. The general entries are all entered as 06:00am for example. I've tried changing the formatting of the cells but as the data is pulled from a website it continually enters refreshed data as a general format.

Is there a code that will change a general entry in the cells in the range (O6:O92) from a ##:##am or ##:##pm to a time format??

Thank you kind people!

Have an excellent day!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
18,144
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi there gurus!

I'm trying to convert a general entry into a cell into a time format. The general entries are all entered as 06:00am for example. I've tried changing the formatting of the cells but as the data is pulled from a website it continually enters refreshed data as a general format.

Is there a code that will change a general entry in the cells in the range (O6:O92) from a ##:##am or ##:##pm to a time format??

Thank you kind people!

Have an excellent day!
Have you tried replacing "am and "pm" by " am" and " pm" (i.e put a space before am and pm)?
 
Upvote 0

mfexcel

Well-known Member
Joined
Jan 8, 2009
Messages
791
If you can use a helper column... try
in P6
=(LEFT(O6,5)&" " &RIGHT(O6,2))+0
Change the cell format to "hh:mm am/pm"
Copy down



Hi there gurus!

Is there a code that will change a general entry in the cells in the range (O6:O92) from a ##:##am or ##:##pm to a time format??

Have an excellent day!
 
Upvote 0

Forum statistics

Threads
1,195,848
Messages
6,011,951
Members
441,657
Latest member
Diupsy

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