NEED TO CONVERT TEXT TO DATE (M/DD/YYYY) FORMAT

asksign

Board Regular
Joined
Mar 22, 2016
Messages
62
Hi All,

I have a text data like 21-08-2023, i need to convert as 8/21/2023, can any one help, tried text to column, formatting method but it doesnt work.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
format will only work if the field is date-type numeric.
you can use a function to chop up the string:

Code:
Public Function cvt2Date(ByVal pvVal)
Dim m, d, y

If IsNull(pvVal) Then Exit Function
If Len(pvVal) = 10 Then
  d = Left(pvVal, 2)
  m = Mid(pvVal, 4, 2)
  y = Right(pvVal, 4)
 
  cvt2Date = m & "/" & d & "/" & y
End If
End Function
 
Upvote 0
Solution

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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