Excel Help Forum
ExcelTip.com
Account Icon Account Icon Account Icon
ExcelTip.com

Go Back   Excel Help Forum > Microsoft Office Application Help - Excel Help forum > Excel Miscellaneous

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

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 06:48 PM.
Reply With Quote
  #2  
Old 01-09-2009, 06: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: 5,728
daddylonglegs is attaining expert status daddylonglegs is attaining expert status
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, 06:11 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 80
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 06:15 PM.
Reply With Quote
  #4  
Old 01-09-2009, 06: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 is now here. lol)
Posts: 3,688
martindwilson is attaining expert status martindwilson is attaining expert status
try
=VALUE(A1)
edit oops to quick sorry
that returns 1 jan 05
Reply With Quote
  #5  
Old 01-09-2009, 06:30 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 80
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, 06: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: 5,728
daddylonglegs is attaining expert status daddylonglegs is attaining expert status
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, 06:45 PM
neowok neowok is offline
Valued Forum Contributor
 
Join Date: 09 Feb 2004
Posts: 80
neowok is becoming part of the community
thanks that worked
Reply With Quote
Reply

Bookmarks

New topics in Excel Miscellaneous


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


All times are GMT -4. The time now is 12:03 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0