The information in this article applies to:
SUMMARYFiles imported from mainframes and other systems may contain dates in the format yy/mm/dd. These date formats are not recognized by Microsoft Excel and are imported as text strings. WORKAROUNDMethod 1: Convert Text to ColumnsIn Microsoft Excel versions 5.x, 7.0, and 97, the following steps convert the data to correctly formatted dates as serialized date numbers.
Method 2: Use a FormulaIn any version of Microsoft Excel, to convert the date text to a serial number, 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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspThe following macro converts the date, to a serial number. If the separator between the yy mm and dd values is not a forward slash (/), then modify the SEARCH statements within the macro, replacing all occurrences of the forward slash with the appropriate character. A1: Convert_DateThe above macro assumes the following:
Additional query words: 5.00c 8.00 97 XL97
Keywords : xlmhowto xlformula |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |