Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Convert a string to a date?

I have a series of entries in col A like this:

Tuesday 7th September 2004
Tuesday 3rd April 2007
etc.
FWIW, all happen to start 'Tuesday' in the present case, although a
fully general solution would be ideal in case I come across
non-Tuesday variations in future.

Is there a simple way to get these into a proper date format please?
I'd be happy with various types, my aim being to abbreviate them. So
for example

Tue 7 Sep 2004
7/9/07
or even
Tuesday 7th Sep 2004

would be OK. Obviously, once I have them in Date format, I can
experiment with the alternatives.

An alternative I suppose would be to do a global Replace. But that
would need repetitions, to change 'January' to 'Jan', February' to
'Feb', etc.

--
Terry, East Grinstead, UK

  #2   Report Post  
Posted to microsoft.public.excel.misc
Rod Rod is offline
external usenet poster
 
Posts: 108
Default Convert a string to a date?

Text to Columns, format each column then concatenate.

"Terry Pinnell" wrote:

I have a series of entries in col A like this:

Tuesday 7th September 2004
Tuesday 3rd April 2007
etc.
FWIW, all happen to start 'Tuesday' in the present case, although a
fully general solution would be ideal in case I come across
non-Tuesday variations in future.

Is there a simple way to get these into a proper date format please?
I'd be happy with various types, my aim being to abbreviate them. So
for example

Tue 7 Sep 2004
7/9/07
or even
Tuesday 7th Sep 2004

would be OK. Obviously, once I have them in Date format, I can
experiment with the alternatives.

An alternative I suppose would be to do a global Replace. But that
would need repetitions, to change 'January' to 'Jan', February' to
'Feb', etc.

--
Terry, East Grinstead, UK


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 329
Default Convert a string to a date?

Hi Terry,

For a 'date' in A1, try:
=DATEVALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTI TUTE(MID(A1,FIND(" ",A1)+1,LEN(A1)),"st",""),"nd",""),"rd",""),"th"," "))
and format the result as a date.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Terry Pinnell" wrote in message ...
I have a series of entries in col A like this:

Tuesday 7th September 2004
Tuesday 3rd April 2007
etc.
FWIW, all happen to start 'Tuesday' in the present case, although a
fully general solution would be ideal in case I come across
non-Tuesday variations in future.

Is there a simple way to get these into a proper date format please?
I'd be happy with various types, my aim being to abbreviate them. So
for example

Tue 7 Sep 2004
7/9/07
or even
Tuesday 7th Sep 2004

would be OK. Obviously, once I have them in Date format, I can
experiment with the alternatives.

An alternative I suppose would be to do a global Replace. But that
would need repetitions, to change 'January' to 'Jan', February' to
'Feb', etc.

--
Terry, East Grinstead, UK

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Convert a string to a date?

"macropod" wrote:

Hi Terry,

For a 'date' in A1, try:
=DATEVALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBST ITUTE(MID(A1,FIND(" ",A1)+1,LEN(A1)),"st",""),"nd",""),"rd",""),"th"," "))
and format the result as a date.

Cheers


Thanks both, I'll try those suggestions.

--
Terry, East Grinstead, UK
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert string to date phil Excel Worksheet Functions 2 October 2nd 06 07:01 PM
convert string to date Sean Excel Worksheet Functions 5 March 1st 06 10:54 PM
Convert Date to STring tonymaguire Excel Discussion (Misc queries) 9 February 15th 06 12:33 PM
Convert text string to date AK Excel Worksheet Functions 1 February 1st 06 07:27 PM
How to convert string to a date galsaba Excel Worksheet Functions 3 March 4th 05 06:20 PM


All times are GMT +1. The time now is 03:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"