dd/mm/yyyy to yyyy-mm-dd

Infine

Board Regular
Joined
Oct 16, 2019
Messages
93
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need help with a simple DATE converter. I have:

02/01/2018
22/03/2019

I want

2018-01-02
2019-03-22


I use this code:

VBA Code:
=TEXT(A1, "yyyy-mm-dd"),

But it does not work, how come? What am I missing? Even formatting (RIGHT CLICK -> FORMAT CELLS) does not work.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try to put a DATEVALUE function around A1 first
 
Upvote 0
Do you mean convert all the dates like this: =DATEVALUE(A1) ? If yes, then it does not work. I get "#VALUE!"
 
Upvote 0
It sounds like your dates are entered as Text.
Do you want to return a Text entry, or a valid date entry?

If you want a valid date entry, use this formula:
Excel Formula:
=DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2))
and then format the cell as yyyy-mm-dd afterwards.

If you want a text entry, then use:
Excel Formula:
=TEXT(DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2)),"yyyy-mm-dd")
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top