View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default convert a text date to a true date

You may have seen debates here in the past about using DATE and
DATEVALUE - the problem with the latter (taking strings) is the
regional variations in strings that are recognised as dates in
different countries, so solutions may not work universally. Bearing
this in mind, I would propose the following:

First of all, set up a table of months and the month number, like
this:

Jan 1
Feb 2
Mar 3
Apr 4
May 5
Jun 6
Jul 7
Aug 8
Sep 9
Oct 10
Nov 11
Dec 12

It doesn't really matter where this is (I put mine in M4:N15), but you
should give the table a name like "months" by highlighting the data
and Insert | Name | Define. Then, if your text date is in K4 in the
format you spelled out in your second post, you can use this formula
to convert it to a proper date:

=DATE(RIGHT(K4,4),VLOOKUP(MID(K4,FIND(",",K4)+2,3) ,months,
2,0),MID(K4,LEN(K4)-7,2))

Obviously, adjust the references to K4 to suit your first cell.

Format the cell appropriately, and then copy down if you have other
dates in column K.

The formula should work whichever country you are in.

Hope this helps.

Pete




On Nov 14, 10:56 pm, JR Hester
wrote:
Thanks Tom for that. MAybe I should be a bit more specific.
My dates are text such as
Sunday, March 3, 2002
Wednesday, April 11, 2004
Friday, December 20, 2003
and so forth.



"Tom" wrote:
I have a situation where my dates come to me as 1071114 (107 is the year, 11,
is the month and 14 is the day). I use the formula
=date(left(a1,3),mid(a1,4,2),right(a1,2)) and it converts to 11/14/2007. May
take a bit of modification but it should work for you.


Luck


"JR Hester" wrote:


I am out of ideas. Excel(tm) XP on WinnXP.
I have acquired a spreadsheet "database" from another user. approximayely 5K
records with dates in the dddd, m-d-yy format, although these appear to be
stored as text. Changing the format does not change theway data is displayed.
Cells were originally formatted as General.


Can anyone offer a simple formula method to change these text entries into a
true date format? I am in process of importing info into an Access(tm) database.


Thanks for any suggestions- Hide quoted text -


- Show quoted text -