Function to convert date from mm / dd / yyyy to yyyy-mm-dd in Excel?

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”.

+4
source share
2 answers

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:

 = TEXT(DATE(2014, 11, 4), "YYYYMMDD") 
+7
source

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".

+1
source

All Articles