Oct 12 2017 12:31 AM
I've got an issue when I am importing a text file and using the text to columns function where its not recoginsing the correct date format in one of the columns. The text file is generated from a system that is based in North America so the date follows the mm/dd/yyyy format. As I am in the UK I need it to be dd/mm/yyyy. For some reason it is able to convert to the correct format for those dates where the day is less than or equal to 12 but when it goes over that it doesnt know what to do with it and just leaves it as text. If one of my collegues in North America carries out the same process it converts them all ok, I'm thinking its a regonal thing but not sure where to start checking. I've attached 2 files, one is the raw txt file, the other is after I import it to Excel. Does anyone have a suggestion as to what the issue might be?
Oct 12 2017 01:33 AM
Hi Craig
On third step of the wuzard select correct date format for that column (US one in your case)
Oct 12 2017 01:42 AM
Hi Sergei - I've tried this method also but it still ends up with the same results. It converst the ones with days less than or equal to 12 and ignores the rest !! Very frustrating.
Oct 12 2017 01:47 AM
Craig, could you please attach text file (or part of it) from which you import?
Oct 12 2017 01:50 AM
Here you go....I've had to change the extension from TXT to csv as it wont let me upload a txt one.
Oct 12 2017 02:05 AM - edited Oct 12 2017 02:06 AM
SolutionCraig, it looks like due to time added to that field. If time is not important for you (i.e. it always 0:00:00) you may open csv file and Text to Columns last column with space separator, remove time only column after that.
See result attached. If the time is important will find somethin else.
Oct 13 2017 01:48 AM
Well it didnt work exactly the way that you thought it would but I've managed to find a solution. Unfortunatley I havent been able to find the route cause of the problem so will have to carry out this work around every time I need to carry out the same action. Thanks for your help Sergei.
Oct 13 2017 06:49 AM - edited Oct 13 2017 06:49 AM
Craig, you may use Power Query (Get&Transform in 2016). It picks you txt file up and transforms correctly if for this column you use Change type->Using locale transformation.
You need to adjust the query only once, perhaps add name of txt file as parameter. After that no additional operations.
Attached is how it looks like, "Import File.txt" for this sample is in the root of C:\
Aug 19 2022 07:14 AM
@Craig Shankland I had a similar issue. The dates were arranged from oldest to latest. Dates with days greater than 12 were formatted as text (mm-dd-yyyy) while those with days less than 12 were fomatted as dates (mm-dd-yyyy). I solved this by selecting "MDY" after checking the Date option in the Text to columns feature. This formatted the entire column as date with the format dd-mm-yyyy (UK format). Looking through the dataset after I solved this was how I got to know the dates were arranged from oldest to latest. I still don't understand why Excel behaves that way though.
Second Image shows the Date_converted column after I changed it to the Long date format.
I would advise you look through your dataset thoroughly before applying this solution.
Apr 02 2023 11:32 PM
Oct 12 2017 02:05 AM - edited Oct 12 2017 02:06 AM
SolutionCraig, it looks like due to time added to that field. If time is not important for you (i.e. it always 0:00:00) you may open csv file and Text to Columns last column with space separator, remove time only column after that.
See result attached. If the time is important will find somethin else.