Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 01-09-2009, 06:52 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 98
neowok is becoming part of the community
convert a text date into a proper date

Please Register to Remove these Ads

I have a column of dates in thie format " January 5 03:09:36 2009" which i need to convert into a proper excel date that i can do further calculations on (adding up things, graphs etc based on dates).

Note the space before the month name. I thought about doing a left(cell,xx) to get it but that isnt going to work with the space infront and the variable length of month names.

I do not necessarily need the time included, it may be useful at some point if its easy to keep it as part of the data, if not i can live without it.

Thanks

Last edited by neowok; 01-09-2009 at 07:48 PM.
Reply With Quote
  #2  
Old 01-09-2009, 07:04 PM
daddylonglegs's Avatar
daddylonglegs daddylonglegs is offline
Forum Moderator
 
Join Date: 14 Jan 2006
Location: England
MS Office Version:2002 (work), 2003 & 2007 (home)
Posts: 6,560
daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding
Are you in the US? If your default date format is m/d/yy then, assuming your timestamp in A1 you can extract the date with this formula in B1

=MID(REPLACE(A1,LEN(A1)-13,9,","),2,99)+0

Format B1 as a date

If you want to include the time, too try

=MID(REPLACE(A1,LEN(A1)-13,0,", "&RIGHT(A1,4)),2,LEN(A1))+0

and format as date and time
Reply With Quote
  #3  
Old 01-09-2009, 07:11 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 98
neowok is becoming part of the community
Thanks

I am in UK so d/m/y

tried those anyway but got #value error, it didnt seem to like the +0 at the end, taking it off seems to show the date but leaves it as text still

Last edited by neowok; 01-09-2009 at 07:15 PM.
Reply With Quote
  #4  
Old 01-09-2009, 07:28 PM
martindwilson's Avatar
martindwilson martindwilson is offline
Forum Guru
 
Join Date: 23 Jun 2007
Location: London,England
MS Office Version:office 97 ,2003 ,2007
Posts: 6,006
martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding martindwilson Has a higher level of understanding
try
=VALUE(A1)
edit oops to quick sorry
that returns 1 jan 05
Reply With Quote
  #5  
Old 01-09-2009, 07:30 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 98
neowok is becoming part of the community
nup dont work, comes up as 1st jan 2005

i think the solution above will work, i just need to figure out how to move the day to the left of the month in the formula to UK format and then i guess itll work
Reply With Quote
  #6  
Old 01-09-2009, 07:41 PM
daddylonglegs's Avatar
daddylonglegs daddylonglegs is offline
Forum Moderator
 
Join Date: 14 Jan 2006
Location: England
MS Office Version:2002 (work), 2003 & 2007 (home)
Posts: 6,560
daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding daddylonglegs Has a higher level of understanding
For UK settings try like this for the date

=REPLACE(REPLACE(A1,FIND(":",A1)-2,9,MID(A1,2,FIND(" ",A1,2)-1)),1,FIND(" ",A1,2),"")+0

and for date and time

=REPLACE(REPLACE(A1,FIND(":",A1)-2,9,MID(A1,2,FIND(" ",A1,2)-1)),1,FIND(" ",A1,2),"")+LEFT(RIGHT(A1,13),8)

If you want date in one cell annd time in another then use the first one for the date and

=LEFT(RIGHT(A1,13),8)+0

for the time
Reply With Quote
  #7  
Old 01-09-2009, 07:45 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 98
neowok is becoming part of the community
thanks that worked
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump