Converting Dates from yy/mm/dd to mm/dd/yy Format
This article was previously published under Q113616
This article has been archived. It is offered "as is" and will no longer be updated.
Files imported from mainframes and other systems may contain dates in theformat yy/mm/dd. These date formats are not recognized by Microsoft Exceland are imported as text strings.
Method 1: Convert Text to ColumnsIn Microsoft Excel versions 5.x, 7.0, and 97, the following steps convertthe data to correctly formatted dates as serialized date numbers.
- Highlight all dates. On the Data menu, click Text To Columns. This opens dialog 1 of 3 of the Convert Text to Columns Wizard.
- In step 1, click Delimited for Original Data Type. Click Next.
- In step 2, click the Tab checkbox. Click Next.
- In step 3, click the Date option button. Click YMD in the list of date formats. Your original data will be overwritten unless you enter a new destination. (The default value is the first cell of the range that you highlighted in step 1 above. Click Finish.
Method 2: Use a FormulaIn any version of Microsoft Excel, to convert the date text to a serialnumber, enter the following formula in the worksheet:
B2: =DATEVALUE(MID(A2,4,2)&"/"&RIGHT(A2,2)&"/"&LEFT(A2,2))The above formula assumes that the date to be converted is in cell A2.
Method 3: Use a MacroMicrosoft Excel 4.0 Macro Example:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following macro converts the date, to a serial number. If theseparator between the yy mm and dd values is not a forward slash (/),then modify the SEARCH statements within the macro, replacing alloccurrences of the forward slash with the appropriate character.
A1: Convert_DateThe above macro assumes the following:
- All the dates are organized in one vertical column.
- The active cell is the first date to be converted in the column.
- There is an empty cell at the end of the column of dates.
5.00c 8.00 97 XL97 XL
Article ID: 113616 - Last Review: 12/04/2015 10:05:47 - Revision: 2.2
Microsoft Excel 4.0 Standard Edition, Microsoft Excel 4.0a, Microsoft Excel 5.0 Standard Edition, Microsoft Excel 5.0c, Microsoft Excel 95 Standard Edition, Microsoft Excel 97 Standard Edition
- kbnosurvey kbarchive KB113616