Converting Time again

PCRIDE

Well-known Member
Joined
Jan 20, 2008
Messages
907
Hi, I've tried several things and excel is still not seeing the time as time.

The system exports the time data in text in this format, note AM and PM

09:00AM
08:00PM

So its like a hybrid 24 hour normal time. Note there is no space between the AM/PM and the time.

If I click into the time field and add a space and hit enter in Excel, Excel now see's it as time.

What formula is best for this, to retain the AM/PM format?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
=TIME(VALUE(LEFT(C1,2)),VALUE(MID(C1,4,2)),0)+0.5*(RIGHT(C1,2)="PM")

Assuming C1 is where the original data is.
 
Upvote 0
Solution
Just another option, cells formatted as hh:mm AM/PM

Book1
AB
209:00AM09:00 AM
311:12PM11:12 PM
408:00PM08:00 PM
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=--REPLACE(A2,6,0," ")
 
Upvote 0
Another (untested) option that I can think of is to change time format in control panel/region/advances configuration/time from "h:mm tt" in the short time format to "h:mmtt". I think then when you open the fresh exported file it should recognize it as time.
As I said, I didn't test it but I think it will work.


1705097187054.png
 
Upvote 0
If you open a excel file where you already have time stored in cells it will show them with the new format.

Anyway I was thinking of this just like of a workaround for opening these exported file only.
1. Change time format to h:mmtt
2. Open .csv files (or whatever type they are)
3. Save excel file with time column recognized correctly.
4. Change time format back to what it was.
 
Upvote 0
If you open a excel file where you already have time stored in cells it will show them with the new format.
Of course it will as it is only a number

Changing the regional format for a temporary fix is not something I personally would do especially as I am getting old and liable to forget to change it back
 
Upvote 0
Of course it's personal preference. I used this approach in the past to open some CSV files and get the right data type.

One more thing that just occurred to me... would power query recognize the time as expected? Don't have desktop version of excel right now to test.
 
Upvote 0
One more thing that just occurred to me... would power query recognize the time as expected? Don't have desktop version of excel right now to test.
It will if it is a CSV (i.e. a comma after each time) in hh:mm:ss format as standard

Book1
A
1Column1
209:00:00
323:12:00
420:00:00
csv2
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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