Convert Text to Date

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
407
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I have the following text in a cell which I would like to convert to a date format dd/mm/yyyy

01/Oct/2016

Is this possible?

Thanks
Craig
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
407
Office Version
  1. 365
Platform
  1. Windows
thanks steve this shows an error as per below
#VALUE!

<tbody>
</tbody>
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
thanks steve this shows an error as per below
#VALUE!

<tbody>
</tbody>
Steve's formula worked for me. Do you have your date in cell A1 (which is where Steve's formula is looking for it)?

Here is another formula you can try...

=0+SUBSTITUTE(A1,"/","-")
 
Upvote 0

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
407
Office Version
  1. 365
Platform
  1. Windows
thanks both, I've noticed that there is a space at the start of the cell which is why this doesn't work. As soon as I delete the space at the start its fine. Is there any way to accommodate for the space?
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
thanks both, I've noticed that there is a space at the start of the cell which is why this doesn't work. As soon as I delete the space at the start its fine. Is there any way to accommodate for the space?
Use the TRIM function...

=DATEVALUE(TRIM(A1))

or

=0+SUBSTITUTE(TRIM(A1),"/","-")
 
Upvote 0

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
5,736
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
To convert in place

Copy a blank cell Ctrl C
then With Paste Special use Add

Or to put the Date in another cell and assuming Text is in A1 =A1+0

If this does not work, check for extraneous characters before or after the text.
 
Upvote 0

thedeadzeds

Active Member
Joined
Aug 16, 2011
Messages
407
Office Version
  1. 365
Platform
  1. Windows
thanks rick, i still get the value error but if I delete the space as per before it works fine
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
thanks rick, i still get the value error but if I delete the space as per before it works fine
Did you get your values from a web page? If so, that is probably not a normal space (ASCII 32), rather, it is probably a non-breaking space (ASCII 160) instead. See if these work for you...

=DATEVALUE(TRIM(SUBSTITUTE(A1,CHAR(160),"")))

or

=0+SUBSTITUTE(TRIM(SUBSTITUTE(A1,CHAR(160),"")),"/","-")
 
Upvote 0

Forum statistics

Threads
1,190,898
Messages
5,983,451
Members
439,843
Latest member
PlanetFitness

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
Top