rexcel

Date cleaning in excel,date values align to the left


I have excel file a date column, some of date are align to the right while others to the left.when i read the into r am getting this error.

Expecting date in A3547 / R3547C1: got '13/04/2018'

on dates align to the left. I have tried to clean the date in excel with no success,


Solution

  • You can do something similar to this

    enter image description here

    Formulas are as below

    enter image description here

    B2: =FIND("/",A2)
    C2: =FIND("/",A2,1+FIND("/",A2))
    D2: =LEFT(A2,B2-1)
    E2: =MID(A2,B2+1,C2-B2-1)
    F2: =RIGHT(A2,4)
    G2: =DATE(F2,E2,D2)
    

    Depending upon your actual data you may need to amend the formulas a little bit.