Change M(M)/D(D)/YYYY format = General ...

adambc

Active Member
Joined
Jan 13, 2020
Messages
412
Office Version
  1. 365
Platform
  1. Windows
... to D(D)/M(M)/YYYY format = Date (so that I can sort old to new) ...

I am working with two extract files from another system that I cannot influence!

I am reading them into a WS in my WB using Power Query / Append ...

But in what should be date columns, the values (in the extracts, PQ is not changing them) are eg 7/1/2023 & 10/13/2022 and format = General (PQ is seeing them as Text) - whereas I need them to read 1/7/2023 & 13/10/2022 respectively AND format = Date ...

Can someone help me please/

Thanks ...
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You can create another column and use a formula like this:

=TEXT(A1,"dd/mm/yyyy")

then format that column as date.
 
Upvote 0
In Excel

Select the column
Data tab
Text to Columns
Delimited
Next
Make sure all the boxes are unchecked
Next
Select Date checkbox
Change the option to MDY (yes MDY as you want the source format)
Click Finish

Important Edit: removed the PowerQuery suggestion as doesn't work correctly
 
Last edited:
Upvote 0
Solution
**Important** - Are any of these coming in as real dates (aligned right) while others are coming in as text (aligned left)?
 
Upvote 0
In Excel

Select the column
Data tab
Text to Columns
Delimited
Next
Make sure all the boxes are unchecked
Next
Select Date checkbox
Change the option to MDY (yes MDY as you want the source format)
Click Finish

Important Edit: removed the PowerQuery suggestion as doesn't work correctly
Bingo, it was the MDY that was foxing me - thanks ...

Shame I can't do it in Power Query!
 
Upvote 0
**Important** - Are any of these coming in as real dates (aligned right) while others are coming in as text (aligned left)?
It doesn't make any difference when using text to columns, it is how it appears in the cell, not it's underlying value
So as long as they are all US dates coming in on a UK setup computer (A3,A6 and A7 were right aligned, the rest left aligned)

Book1.xlsb
A
1Date
27/23/2023
307/01/2023
49/16/2023
509/16/2023
611/12/2023
709/10/2023
Sheet5

becomes
Book1.xlsb
A
1Date
223/07/2023
301/07/2023
416/09/2023
516/09/2023
612/11/2023
710/09/2023
Sheet5
 
Upvote 0
It is good that your answer is "No", otherwise the solution would have left you with some inaccurate dates.
Rick, please see my last post (number 7) and let me know which results you consider wrong, if it is imported from a text file that is how the first sample would appear on a uk machine (and would be right aligned (real dates) if they looked like uk dates in the text file)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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