Within Excel 2010, I need to convert dates that are formatted mmddyyyy to ddmmyyyy. Have tried Custom number formats and can’t seem to get anything to work. Ideas anyone?
Thanks,
Ken
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Converting date formats in Excel
I assume these are text string, not real dates.
Do you want to just change the text strings , or convert them to real dates?
If you want to convert the string use a formula
=Mid(CellRef,3,2)&Left(CellRef,2)&Right(CellRef,4)
If You want to convert the string to a real date then use
=Date(Right(CellRef,4),Left(CellRef,2),Mid(CellRef,3,2)) and use a format to show as a date
Where CellRef is the appropriate Cell Reference.
Here’s a vba solution, that changes the order within the cells concerned:
Sub Demo() Dim oCel As Range, TmpVal As Long For Each oCel In Selection If IsNumeric(oCel.Value) And oCel.HasFormula = False Then If Len(oCel.Value) = 8 Then _ TmpVal = Mid(oCel.Value, 3, 2) & Left(oCel.Value, 2) & Right(oCel.Value, 4) If Len(oCel.Value) = 7 Then _ TmpVal = Mid(oCel.Value, 2, 2) & "0" & Left(oCel.Value, 1) & Right(oCel.Value, 4) oCel.Value = TmpVal End If Next End Sub
I’ve assumed the ‘dates’ are simply numbers, in which case, there’ll be some that are only 7 digits long as the leading 0 won’t be held for months less than 10.
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.