Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Parsing Non-Standard Date Formats.

Parsing Non-Standard Date Formats

by Allen Wyatt
(last updated February 24, 2020)


Bill is faced with the challenge of importing data into Excel that was originally created in other applications. The problem is that the data contains lots of dates, but they are in a format that Excel doesn't understand. For instance, the dates may be in the format 09.15.20 or 9.15.2020, neither of which is treated as a date by Excel. Bill wants to know how to convert the non-standard dates to a date format that Excel understands.

If the dates are in the same sequence format that you use in your regional settings, then converting is a snap. For instance, if your regional settings use the date format MDY (month followed by day followed by year), and the date you are importing is in the same format, then you can simply select the cells and replace the periods with a slash. When Excel changes 9.15.2020 to 9/15/2020, it automatically parses the result as a date.

If the format you are importing doesn't match your regional settings, then you need to shuffle around the date into the same format. For instance, if the date you are importing is 09.10.20 (September 10, 2020), and your system would interpret this as October 9, 2020, then the easiest way is to separate the date into individual components, and then put them back together. Follow these general steps:

  1. Insert three blank columns to the right of the date column.
  2. Select the cells containing the non-standard dates.
  3. Using the Text to Columns tool (available in the Data Tools group on the Data tab of the ribbon) choose delimited data and use a period as the delimiter. After the wizard is done, you end up with three columns containing the month, day, and year.
  4. In the remaining blank column, enter a formula such as the following:
  5.      =DATE(C1,A1,B1)
  6. Copy the formula down to other cells next to the dates.
  7. Select the cells containing the formulas you just created, then press Ctrl+C.
  8. Use Paste Special to convert the formulas to results. (Select the Values option when using Paste Special.)
  9. Delete the three columns that contain the separated dates and keep the column that contains the final dates.

Another solution is to simply use a macro to do the conversion. The following is a user-defined function that takes the non-standard date and converts it to a properly formatted date value. The macro also switches around the position of the month and day, as done in the Text to Columns technique.

Public Function Convert_Date(A As String) As Date
    Dim K As Long
    Dim K1 As Long
    Dim K2 As Long

    K = Len(A)
    K1 = InStr(1, A, ".")
    K2 = InStr(K1 + 1, A, ".")
    Convert_Date = DateSerial(Val(Mid(A, K2 + 1, _
      K - K2 + 1)), Val(Mid(A, K1 + 1, K2 - K1)), _
      Val(Mid(A, 1, K1 - 1)))
End Function


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9837) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Parsing Non-Standard Date Formats.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Using Merge Fields

When creating a mail merge document, you use merge fields to indicate where the information from each record of your data ...

Discover More

A Fast Find-Next

Tired of the Find and Replace dialog box blocking the view of your worksheet when you are searching for information? Do ...

Discover More

Printing in Black and White and Color

Excel can print your worksheets in either black and white or color. If you want to print everything in black and white ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Using a Two-Character Day of the Week in a Date Format

Excel provides quite a bit of flexibility in how you can format dates. Even so, some dates simply cannot be formatted ...

Discover More

Determining Business Quarters from Dates

Many businesses organize information according to calendar quarters, especially when it comes to fiscal information. ...

Discover More

Calculating Fractions of Years

When working with dates and the relationship between dates, Excel provides a variety of worksheet functions that may ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine more than 5?

2020-02-12 07:21:26

Chuck Trese

my apologies. I should have read your comment more carefully.

2020-02-11 03:27:18



Many thanks both, but I was merely pointing out that the DATE formula method and the UDF were not working the same with the given examples of dates which are all in m.d.yy format.

I should have said that 'The macro above was not PARSING correctly'.

The article does explain that neither of these methods are really required for dates in the correct regional order.

2020-02-10 12:44:34

Phil W

The 9.15.20 example is not a valid date if the date format is d.m.yy, which I believe is the assumption in the Convert_Date routine above. If you are converting dates in d.m.yy, you will need to modify the code to shuffle the month and day accordingly.

Here is a more flexible function that can handle multiple date formats. I added a second parameter to the function that specifies the date format.

Public Function Convert_Date(sDate As String, sDateFormat As String) As Date
' Defined formats:
' "m.d.yy", "m.d.yyyy", "mm.dd.yy", "mm,dd,yyyy"
' "d.m.yy", "d.m.yyyy", "", ""
' "yy.m.d", "yyyy.m.d", "", ""

Dim sDelim As String, sMnth As String, sDay As String, sYr As String
Dim DelimPos1 As Long, DelimPos2 As Long, i As Long

'Determine what the delimiter character is and positions within the date string
For i = 1 To Len(sDate)
If Not IsNumeric(Mid(sDate, i, 1)) Then
sDelim = Mid(sDate, i, 1)
If DelimPos1 = 0 Then DelimPos1 = i
If DelimPos1 > 0 And i > DelimPos1 And DelimPos2 = 0 Then DelimPos2 = i
End If
' Check to make sure there are two delimiter positions.
If DelimPos1 = 0 Or DelimPos2 = 0 Then GoTo DateError

' Parse the date string into month, day and year strings.
' Three general date formats with variations of each are listed here. If others are needed, add additional cases
Select Case sDateFormat

Case "m.d.yy", "m.d.yyyy", "mm.dd.yy", "mm,dd,yyyy"
sMnth = Left(sDate, DelimPos1 - 1)
sDay = Mid(sDate, DelimPos1 + 1, DelimPos2 - DelimPos1 - 1)
sYr = Right(sDate, Len(sDate) - DelimPos2)

Case "d.m.yy", "d.m.yyyy", "", ""
sDay = Left(sDate, DelimPos1 - 1)
sMnth = Mid(sDate, DelimPos1 + 1, DelimPos2 - DelimPos1 - 1)
sYr = Right(sDate, Len(sDate) - DelimPos2)

Case "yy.m.d", "yyyy.m.d", "", ""
sYr = Left(sDate, DelimPos1 - 1)
sMnth = Mid(sDate, DelimPos1 + 1, DelimPos2 - DelimPos1 - 1)
sDay = Right(sDate, Len(sDate) - DelimPos2)

Case Else
' Unknown date format parameter. Add more formats if necessary
GoTo DateError
End Select

' Make sure the month, day and year strings are numeric and the month is in range (1-12).
' If not, return 1/1/1900 indicating an error
If Not IsNumeric(sDay) Or Not IsNumeric(sMnth) Or Not IsNumeric(sYr) Then GoTo DateError
If CInt(sDay) > 1 And CInt(sMnth) > 0 And CInt(sMnth) <= 12 And CInt(sYr) > 0 Then
GoTo ConvertDate
End If

' Unknown or invalid date format; return 1/1/1900
sMnth = "1"
sDay = "1"
sYr = "1900"

Convert_Date = DateSerial(sYr, sMnth, sDay)
End Function

2020-02-10 09:08:42

Chuck Trese

Hi Mike,
Check your formula.
The formula's syntax is DATE(Year,Month,Day).
In the example given, that was DATE(C1,A1,B1).

2020-02-10 03:51:45


The macro above is not doing the column shuffling correctly.
the example given of 9.15.20 is converted to 09/03/2021.

15.9.20 is correctly converted to 15/09/2020

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.