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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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