Written by Allen Wyatt (last updated November 22, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
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:
=DATE(C1,A1,B1)
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
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9837) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Parsing Non-Standard Date Formats.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Excel can easily store dates. If you want to increment a date by one month, there are a number of ways you can accomplish ...
Discover MoreExcel is brilliant at handling dates--as long as they aren't dates earlier than the base date used by the program. If you ...
Discover MoreNeed to calculate the date that is a certain number of workdays in the future? You can do so using a couple of different ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-04-18 23:16:47
Alex B
In scenario where "format you are importing doesn't match your regional settings". The above solution suggests using Text to Columns and a formal.
The text to columns function can do it in one step.
a) Select the Cell or column
b) Text to Columns
c) Delimited - pick something that doesn't exist eg TAB
d) On the next screen select "Date"
e) from the drop down box select the format that the date you are seeing is in
eg in the above example if 09.10.2020 is meant to be October 9, 2020 then the date format you select is DMY
f) select a destination and hit finish
(see Figure 1 below)
The above will also work instead of the replace in the first option is you find it quicker and in fact should be available when you import the data in the first place.
Figure 1. Convert Text to Column
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments