How to make excel understand custom format dates?

Radecki

New Member
Joined
Oct 23, 2013
Messages
17
Hi All,

I get dates from another tool in a custom format and Excel does not recognize it as dates, here is an example:

Sep 10, 2023, 5:51:06 AM
Sep 10, 2023, 1:01:21 AM
Sep 9, 2023, 2:32:44 PM
Sep 8, 2023, 10:09:29 PM

The other tool will not allow to change the date format on the output, hence the conversion needs to happen in Excel.
I only need month, day and a year. The time can be removed.

Any idea how to convert it into a format that Excel would understand?
Please help, I tried with Datevalue function and Text to column option but both failed for me (but I may be doing it wrong).

Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Power Query will remove these easily for you.

1. Import your dates into Power Query
2. Then go 'Add Column' -> Date -> Parse
3. Rename your new column as desired and remove the old column if needed
4. Load the corrected dates back into your sheet
 
Upvote 0
in excel, try:
for excel 365. Please update your excel version, as this may not work for you.
Excel Formula:
=DATEVALUE(TEXTBEFORE(A2,",",2))+TIMEVALUE(TEXTAFTER(A2,", ",2))
 
Upvote 0
If using an older version of Excel then you could use a small UDF:
VBA Code:
Function DateFix(str As String)
    Dim var As Variant
    
    var = Split(Replace(str, ",", ""), " ")
    DateFix = CDate(Join(Array(var(0), var(1), var(2)), " "))
End Function

Used in the spreadsheet like this:
Excel Formula:
=DateFix(A1)
 
Upvote 0
Here are the 365 and non 365 worksheet formula versions. (I'm sure there are many ways to do this):
You can do the date formatting.

Mr excel questions 66.xlsm
ABC
1365non 365
2Sep 10, 2023, 5:51:06 AM45179.2438245179.24382
3Sep 10, 2023, 1:01:21 AM45179.042645179.0426
4Sep 9, 2023, 2:32:44 PM45178.6060645178.60606
5Sep 8, 2023, 10:09:29 PM45177.9232545177.92325
Radecki
Cell Formulas
RangeFormula
B2:B5B2=DATEVALUE(TEXTBEFORE(A2,",",2))+TIMEVALUE(TEXTAFTER(A2,", ",2))
C2:C5C2=DATE(MID(A2,FIND(", ",A2)+2,4), MATCH(MID(A2,1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0), MID(A2,FIND(" ",A2)+1,FIND(",",A2)-FIND(" ",A2)-1) ) +TIMEVALUE(TRIM(SUBSTITUTE(A2,LEFT(A2,FIND(":",A2)-3),"")))
 
Upvote 0
Solution
Thank you @awoohaw, I was looking for a function to resolve this issue (rather than power query or VBA). I have a 365 Excel and somehow the datevalue function didn't work but the non 365 function (date) did the trick, thank you!

Thank you all!
 
Upvote 0
Thank you @awoohaw, I was looking for a function to resolve this issue (rather than power query or VBA). I have a 365 Excel and somehow the datevalue function didn't work but the non 365 function (date) did the trick, thank you!

Thank you all!
Strange. Did you try to debug it any? Are there extra characters in your text dates that isn't in what I used? Anyway, you found a solution here.

Best wishes!
 
Upvote 0
check your system's Regional Settings for dates

See Excel's help

DateValue will work if the data's date and systems date have the same Regional Settings.

Dates Time.xlsm
AD
1
2Sep 8, 2023, 10:09:29 PM08-Sep-23 22:09:29
3Sep 10, 2023, 5:51:06 AM10-Sep-23 05:51:06
4
5Sep 8, 2023, 10:09:29 PM08-Sep-23 22:09:29
6Sep 10, 2023, 5:51:06 AM10-Sep-23 05:51:06
7
3f
Cell Formulas
RangeFormula
D2:D3,D5:D6D2=DATE(MID(A2,FIND(",",A2,1)+2,4),MONTH(1&LEFT(A2,3)),MID(A2,FIND(" ",A2)+1,FIND(",",A2)-FIND(" ",A2)-1))+TEXTAFTER(A2," ",3)
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
Latest member
Mr Hughes

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