Converting String to Date in Excel

前端 未结 2 544
忘了有多久
忘了有多久 2021-01-24 07:19

I\'ve got date strings formatted this way: \"Tuesday, January 3, 2012\"

How can I convert them in a date format in Excel 2010?

Thank you in advance!

相关标签:
2条回答
  • 2021-01-24 07:41

    There's the DATEVALUE worksheet function which converts text to dates, however it doesn't seem to accept "Tuesday, January 3, 2012". But it does accept e.g. "3 January 2012" so if you manipulate the string into that format you should be able to get it to work.

    Just a thought, these data functions like DATEVALUE often depend on your display settings for date, so what works for me in London UK may be different if you're elsewhere in the world with different display settings.

    0 讨论(0)
  • 2021-01-24 07:54

    What works can depend on regional settings. If you have US regional settings this formula will give a date based on your data in A1

    =TRIM(REPLACE(A1,1,FIND(",",A1),""))+0

    format in required date format

    This version should work on a wider range.....

    =TRIM(MID(A1,LEN(A1)-7,2)&REPLACE(REPLACE(A1,LEN(A1)-7,3,""),1,FIND(",",A1),""))+0

    Try this version which should work for Italian settings - [I assume the data is in English as shown, e.g. months are January, February etc.]

    =DATE(RIGHT(A1;4);SEARCH(MID(A1;FIND(",";A1)+2;3);"xxjanfebmaraprmayjunjulaugsepoctnovdec")/3;MID(A1;LEN(A1)-7;2))

    0 讨论(0)
提交回复
热议问题