Looking for Formula Or Macro To Fix Date Formatting Problem

Excelmancan

New Member
Joined
Jun 27, 2010
Messages
32
Hi Everyone,

Here is my issue. I have a large dataset that I download from an outside source from time to time. All is good except the dates. Is there a way that a formula or a macro can be created that would convert the format that is seen below in the 1st 6 example dates that we be returned in the format as seen with the balance without affecting the "good dates".

2012-01-17
2012-03-17
2012-05-17
2012-08-17
2012-09-17
2012-12-17
12/14/17
12/17/17
12/19/17
12/23/17
12/27/17
12/28/17
12/31/17

<colgroup><col></colgroup><tbody>
</tbody>

Thanks.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Assuming you don't have dates that are before 1-Jan-2000 & your date is in cell A1 maybe the below formula would work

=IF(--ISNUMBER(A1)=0,DATE(MID(A1,7,2)+100,MID(A1,1,2),MID(A1,4,2)),A1)
 
Upvote 0
Perfect mse330. Yes, there can be circumstances that it is before 2000.


Assuming you don't have dates that are before 1-Jan-2000 & your date is in cell A1 maybe the below formula would work

=IF(--ISNUMBER(A1)=0,DATE(MID(A1,7,2)+100,MID(A1,1,2),MID(A1,4,2)),A1)
 
Upvote 0
Perfect mse330. Yes, there can be circumstances that it is before 2000.

In this case, you can just add "if condition" if you know how far back the date could get to ... For example, if you know that 1985 is the oldest date you might have then don't add the 100 in the year
 
Upvote 0
Actually I just realized that the formula does not work. Here are the results....I should have been clear with my example. Below, the first 3 dates should actually be Oct 6th, 7th and 10th in 2017 respectively.

2010-06-1740346
2010-07-1740376
2010-10-1740468
10/13/1743021
10/15/1743023
10/17/1743025

<colgroup><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
dates are stored as integers (with 1 = 1 Jan 1900). Just format those numbers as dates and off you go...
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,854
Members
449,051
Latest member
excelquestion515

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