Turning text into dates with vba (or formula)

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

So in column A I have text recorded like this "Oct 16, 2015 6:29:29 PM PDT"

in column AA I want it to show just as the date "Oct 16 2015" not text but date

Please help if you can

Thanks

Tony
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
are they all exactly the same format as text
 
Upvote 0
So in column A I have text recorded like this "Oct 16, 2015 6:29:29 PM PDT"

in column AA I want it to show just as the date "Oct 16 2015" not text but date
If your text data is always in the format you show, then you can use this formula to retrieve just the date (in serial form... use cell formatting to make it look like an actual date)...

=0+LEFT(A1,LEN(A1)-15)
 
Upvote 0
two small observations

if i use the 0+ then I get #VALUE ! and when custom formatted to mmm dd yyyy the comma appears, none of which is relevant to me :)
 
Upvote 0
two small observations

if i use the 0+ then I get #VALUE ! and when custom formatted to mmm dd yyyy the comma appears, none of which is relevant to me :)
Are you referring to the formula I posted in Message #3 ? If so, what you say is happening to you does not happen for me... my formula works fine and the custom format you show does not display a comma. If it might matter, I am using the computer with US locale settings.
 
Upvote 0
Hi Rick,

Thanks for your help but It doesn't seam to work? I just get a #value error? the text is exactly as shown?
I'm in the uk, if that effects anything ? using excel 2016 on a PC
 
Upvote 0
UK settings here, I was expecting 0+ to work. (ISNUMBER) says the text is not a number
 
Upvote 0
this will do it, I put your date into L4

=DATE(MID(L4,9,4),MONTH(1&LEFT(L4,3)),MID(L4,5,2))
 
Upvote 0
Rick

I also get #VALUE ! with your formula so it probably is a UK settings thing,
 
Upvote 0
I am not sure you can use text as a basis for making another cell display custom format as a date data type. I believe the destination cell would have to have a date value entered and then be formatted to display as the custom format. I got the format to display easy enough, but the data type remained general.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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