ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   space before date in csv files (https://www.excelbanter.com/excel-discussion-misc-queries/36308-space-before-date-csv-files.html)

birkato

space before date in csv files
 

I often have to import CSV files into excel and the files contain dates
such as

1/2/05 12:22:12 PM

The problem is that when I import them, there is a space before the
date so it is not taking as a date unless I remove the space. I tried
to use the "TRIM" command and it does take the space off, but it still
won't recognize those values as dates for some reason. If I use the
trim function and then copy the values only into another cell it still
won't act as a date until I go in to edit the cell and then click out
of it.

Has anyone ever run into this and do you have any suggestions?


--
birkato
------------------------------------------------------------------------
birkato's Profile: http://www.excelforum.com/member.php...o&userid=21011
View this thread: http://www.excelforum.com/showthread...hreadid=388751


Bernie Deitrick

birkato,

=TRIM(A1)*1

will force the string that TRIM returns into a date (a number, actually). Simply format the cell
with the formula as a date.

HTH,
Bernie
MS Excel MVP


"birkato" wrote in message
...

I often have to import CSV files into excel and the files contain dates
such as

1/2/05 12:22:12 PM

The problem is that when I import them, there is a space before the
date so it is not taking as a date unless I remove the space. I tried
to use the "TRIM" command and it does take the space off, but it still
won't recognize those values as dates for some reason. If I use the
trim function and then copy the values only into another cell it still
won't act as a date until I go in to edit the cell and then click out
of it.

Has anyone ever run into this and do you have any suggestions?


--
birkato
------------------------------------------------------------------------
birkato's Profile: http://www.excelforum.com/member.php...o&userid=21011
View this thread: http://www.excelforum.com/showthread...hreadid=388751





All times are GMT +1. The time now is 03:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com