I was wondering how to convert dates from mm / dd / yyyy format to yyyy-mm-dd format in Excel after importing data from a CSV file.
Unfortunately, changing the date format to “Cell Format” does not seem to work, so I need to know the function call to convert dates from the string type to enter the “date”.
Properly:
= DATE(RIGHT(A1,4),LEFT(A1,2),MID(A1,4,2))
Update
First convert the text to actual dates using DateValue , and then return them to the correct format using the Text() function:
DateValue
Text()
= TEXT(DATE(2014, 11, 4), "YYYYMMDD")
You can also select the range that you want to change the date format, then right-click and select "Format Cells" in the context menu. Change the type to "aaaa-mm-dd".