Fixing my date format

robertdino

New Member
Joined
Jun 25, 2017
Messages
13
I have a huge excel sheet with dates in MM/DD/YYYY format (ex. 29/05/2020)

Problem is that some of the cells are in M/DD/YYYY format which is possible when the month number is a unit (less than 10), obviously (ex. 6/05/2020)

Now I want to change all cells to DD/MM/YYYY format and I am unable to do this because all cells that have a number in MM beyond 12 convert properly but those with MM as 12 or below remain in the same MM/DD/YYYY format.

Can someone help? I bought Kutools too.
 

Attachments

  • AmBZP34bLd.png
    AmBZP34bLd.png
    64.5 KB · Views: 16

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Do you import those data from a csv (or txt) file?
 
Upvote 0
From multiple files in the past and now I need to export this data with these dates in DD/MM/YYYY format.
 
Upvote 0
In Excel, a date is a date whichever format you use to display it, so probably you "only" need to export that column as a date and not as a string of text.
The biggest problem we have is that now when we read 06/01/yyyy we don't know whether the original date was Jan-6 or Jun-1 (because both were translated in 06/01/2014)
Is there a way to understand that? Are they still in the original sequence or have they been mixed?
I mean: from the image it is clear that your dates where May-30, May-31, Jun-1, Jun-2 and so on; but I see twice a "06/01/2014": do we have to translate both as June-01-2014, or one of those should say "Jan-6-2014"?
If you format as Number" one of the 06/01/2014, what do you read: 41791 or 41645? or what?
 
Upvote 0
I have a huge excel sheet with dates in MM/DD/YYYY format (ex. 29/05/2020)

Problem is that some of the cells are in M/DD/YYYY format which is possible when the month number is a unit (less than 10), obviously (ex. 6/05/2020)

Now I want to change all cells to DD/MM/YYYY format and I am unable to do this because all cells that have a number in MM beyond 12 convert properly but those with MM as 12 or below remain in the same MM/DD/YYYY format.

Can someone help? I bought Kutools too.
This shall require multiple steps - It may sound long but it's actually very easy.

  1. First keep the data back to MM/DD/YYYY or DD/MM/YYYY format )which is your system's default format right now) just to keep uniformity.
  2. Then convert whole column to number - I generally select and click , (comma) to do that.
  3. Then sort column ascending or descending - sorting number and Text separate (it shall ask you while sorting.
  4. Now you have got all the problematic entries at one place together.
  5. Simply convert them to dates using default format of step 1 - This step might require some alternative solutions if not getting the desired result.
    1. Add a temporary helper column and put a formula
      Excel Formula:
      =TEXT(A2,"mm/dd/yyyy")
      assuming dates start from cell A2 in column A:A
    2. Note: "mm/dd/yyyy" or "dd/mm/yyyy" in the above formula must match your system's default date format
    3. Now you can simple copy the values from helper column and paste as values in Corresponding Column A cells
  6. Once done that - Now you convert your whole column A to any format you want to.
Try it. Hope it helps
 
Upvote 0
N.B. My systems Regional Settings for dates are short date dd-mm-yy (28-08-22) and long date dd-mmm-yyyy (28-Aug-2022)

1. can you start with the original text before your system converted some of the data?
2. What are your regional settings for Dates?
3. I used Data Text to Columns on B2:B6 to yield C2:C6
4. You can export just the values and the recipient can format to their preference


T202208a.xlsm
ABCDE
1TextDatesValue
2TEXT in B29-5-202229-May-2229-May-2244710
3TEXT in B05-05-202205-May-2205-May-2244686
4TEXT in B15-1-202215-Jan-2215-Jan-2244576
5TEXT in B15-12-202215-Dec-2215-Dec-2244910
6TEXT in B15-5-202215-May-2215-May-2244696
7
8Mixed Text and Values29-5-201429-May-201441788
9Mixed Text and Values30-5-201430-May-201441789
10Mixed Text and Values06-01-201401-Jun-201441791
11Mixed Text and Values06-02-201402-Jun-201441792
12
8a
Cell Formulas
RangeFormula
D2:D6D2=DATEVALUE(B2)
E2:E6,E8:E11E2=C2
C8:C11C8=IF(ISNUMBER(B8),DATE(YEAR(B8),DAY(B8),MONTH(B8)),DATEVALUE(B8))
 
Upvote 0
I think I know how to fix this.

Can someone just tell me how I can add "0" prefix for cells with singular MONTH digits so I can change all M/DD/YYYY to MM/DD/YYYY format?

In other words, I want to convert all entries like this

6/14/2014

TO

06/14/2014

All these entries are in the same column. I just need a find/replace regex, someone help.
 
Upvote 0
If you are sure that this is the trick then
-in a free colomn, row 2, insert the formula
Excel Formula:
=IF(FIND("/",A2)=2,"0"&A2,A2&"")
This assume your text is in column A, from A2 down; adapt the formula for different column

Copy the formula down

Copy the result of the formulas and paste-special /Values to the initial column; then you may delete the formulas

For sure this method will fail if the column contais text (such as 05/31/2014) and dates (those cells that will look as numbers if you format as Numbers); one of the reason for failure is that at the moment we don't know whether a date now shown as 06/01/yyyy was initially a 06/jan/yyyy or a 01/jun/yyyy
 
Upvote 0
I think I know how to fix this.
Are you sure ? ;)

By the image you posted my guess is that your source file is in the format m/dd/yyyy and your region setting is dd/mm/yyyy.

If nobody has made manual adjustments to the data loaded a Text to Columns conversion should fix both the Text and non-Text items.
Just select date format = MDY when you do the conversion.

Your data seems to be in sequential date order so it should be relatively easy to do a sensibility check on the conversion,


1661850686653.png


Output Example

Book1
AB
1BeforeAfter Text to Columns
25/29/201429/05/2014
35/30/201430/05/2014
45/31/201431/05/2014
506/01/20141/06/2014
606/02/20142/06/2014
706/03/20143/06/2014
Date Conversion
 
Upvote 0
Solution
Are you sure ? ;)

By the image you posted my guess is that your source file is in the format m/dd/yyyy and your region setting is dd/mm/yyyy.

If nobody has made manual adjustments to the data loaded a Text to Columns conversion should fix both the Text and non-Text items.
Just select date format = MDY when you do the conversion.

Your data seems to be in sequential date order so it should be relatively easy to do a sensibility check on the conversion,


View attachment 72798

Output Example

Book1
AB
1BeforeAfter Text to Columns
25/29/201429/05/2014
35/30/201430/05/2014
45/31/201431/05/2014
506/01/20141/06/2014
606/02/20142/06/2014
706/03/20143/06/2014
Date Conversion

>By the image you posted my guess is that your source file is in the format m/dd/yyyy and your region setting is dd/mm/yyyy.
Yes, right.

You are the man, this fixed everything.
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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