Reputation: 51
I have a row of cells in Excel filled with datetimes in the following messy format: July 13, 2016 at 12:10AM
. I want to convert this to 2016/07/13 12:10
('yyyy/mm/dd hh:mm' in the 24h format). Can I do this using a formula or should I write a vba code for this?
Upvotes: 0
Views: 264
Reputation: 152450
Two issues:
First you must remove the at
Second you need a space between the time and the AM
or PM
The follow formula will turn it into a date/time:
=--SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"at",""),"AM"," AM"),"PM"," PM")
Then you can format the cell with the custom format:
yyyy/mm/dd hh:mm
Upvotes: 1