Convert date looking values to Date format

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
Greetings,

I have data in COL H that for the most part represents dates (it is stored as text). I want another column (say... COL K) to have a formula that will convert any of the "date looking" values into a date string in "YYYY.MM.DD" format.... any suggestions on an IF or MID or LEFT, etc.... type formula that I could use?? If the value is not "date looking" it should remain (i.e. blank cells, "Production")

Here is some sample data (COL H):
E11.05.2010
12.10.2010
Production
06.11.2011
E11.05.2010


Here is the result I am looking for (COL K):
2010.11.05
2010.12.10
Production
2011.06.11
2010.11.05


Thanks!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try this user-defined function (UDF):
Code:
Public Function CVDate(cellValue As String) As String
    Dim parts As Variant
    CVDate = cellValue
    parts = Split(cellValue, ".")
    If UBound(parts) = 2 Then
        If Val(parts(0)) = 0 Then parts(0) = Mid(parts(0), 2)
        CVDate = parts(2) & "." & parts(1) & "." & parts(0)
    End If
End Function
Use it like a formula in a cell:
=CVDate(H1)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,258
Members
452,901
Latest member
LisaGo

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