Parsing non-standard date format in Excel cell

后端 未结 3 973
南笙
南笙 2021-01-28 19:36

I want to convert dates formatted like \"March 30th 2017, 05:00:00.000\" to an excel date value? What\'s the most elegant solution I can do this with using a cell-formula and no

3条回答
  •  余生分开走
    2021-01-28 20:24

    If you want a true date and want to drop the time part then:

    =DATEVALUE(SUBSTITUTE(LEFT(A1,FIND(",",A1)-1),"th",","))
    

    You will need to nest SUBSTITUTE() functions to handle "nd" and "st" ordinals if you have them:

    =DATEVALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LEFT(A1,FIND(",",A1)-1),"th",","),"nd",","),"st",","))
    

提交回复
热议问题