Forum Discussion

Stewart_H's avatar
Stewart_H
Copper Contributor
May 02, 2020

Date format problems

I am working on a data set output from a blood sugar test meter (Bayer Contour Next USB)

1020 rows, 19 columns. Imported as CSV. 

I want to sort the data by the date column but from row 400 onward it will not sort by date order. I have tried altering the date format of the column, but only rows 1 to 399 will do change format, the rest stay as they were and the sort function does not recognise the rows as dates and will not sort them.

I have tried saving as .xlsx. Same problems.

Any ideas anyone?

7 Replies

  • Khizar_Hayat's avatar
    Khizar_Hayat
    Brass Contributor

    Stewart_H some date in date column is import as text for sorting all the date it is essential that all are in date format i used text to column in data tab to convert all your date in date format i have attached a solution file check it, 

    • SergeiBaklan's avatar
      SergeiBaklan
      Diamond Contributor

      Khizar_Hayat 

      I'm not sure that is correct result. Let take these two records in initial file

      Most probably in #54 in source csv file it was 11/08/2019. Since both 11 and 08 are less than 12, Excel was interpreted $54 as date in local format and converted to Aug 11. Text to Columns on result keeps converted date as it is, thus we have

      Most probably in #54 it shall be Nov 08, or 2019-11-08 in ISO format. Same for some other records.

       

      Thus I'd suggest to convert properly source csv file, not to transform intermediate files.

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Stewart_H 

    That's since some "dates" are kept as text, some are converted wrongly.

    Importing csv file do not rely on automatic conversion. If that's legacy wizard, on third step apply Date to this column with MDY format. 

    • Stewart_H's avatar
      Stewart_H
      Copper Contributor

      SergeiBaklan 

      Yes, that is the issue. Some of the text will not reformat to date.

      The CSV file is created by the software on the blood test meter which is not accesible by me. Can I control how excel converts it when I open the CSV file?

      @Khizar_Hayyat has managed to convert all cell to date format but day and month have been mixed up.

      @Khizar_Hayyat How did you convert all to date format?  Simple explaination for excel novice please.

       

Resources