Convert general string to date format

thelad

Board Regular
Joined
Jan 28, 2011
Messages
245
Hi,

Is it possible to convert general format cell to a date format? for example in cell A1 is Oct 1 2023 12:00AM i want to convert this to be 01/10/2023 date format. To note all the cells will have same 12:00AM at end.

Example:
Oct 1 2023 12:00AM become 01/10/2023
Nov 30 2023 12:00AM becomes 30/11/2023
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
One way (at least on American systems).
If your value is in cell A1, use this formula:
Excel Formula:
=DATEVALUE(LEFT(SUBSTITUTE(A1," 12:00AM",""),LEN(SUBSTITUTE(A1," 12:00AM",""))-5) & ", " & RIGHT(SUBSTITUTE(A1," 12:00AM",""),4))
and then format the cell to "dd/mm/yyyy"
 
Upvote 0

thelad,​

try this:
VBA Code:
Sub NNN()
    [A1] = Format([A1].Value, "dd/mm/yyyy h:mmAM/PM")
End Sub
 
Upvote 0
Please update your Account Profile to indicate what version of Excel you using.
If you have MS 365 something like this might work for you.
Excel Formula:
=LET(dt,TEXTSPLIT(A1," "),
DATEVALUE(INDEX(dt,,2)&"-"&INDEX(dt,,1)&"-"&INDEX(dt,,3)))
 
Upvote 0
=DATEVALUE(LEFT(SUBSTITUTE(A1," ",", ",2),12))

Format as date
 
Upvote 0
It should've

Book1
AB
1Oct 1 2023 12:00AM01/10/2023
2Nov 30 2023 12:00AM30/11/2023
Sheet1
Cell Formulas
RangeFormula
B1:B2B1=DATEVALUE(LEFT(SUBSTITUTE(A1," ",", ",2),12))
 
Upvote 0
N.B. This system has International Date settings dd-mmm-yyyy.

Dates Time.xlsm
AB
1Oct 1 2023 12:00AM01/10/2023
2Nov 30 2023 12:00AM30/11/2023
3
4m
Cell Formulas
RangeFormula
B1:B2B1=--CONCAT(INDEX(TEXTSPLIT(A1," ",,1),{2,1,3}))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

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