A Microsoft Office (Excel, Word) forum. OfficeFrustration

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. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formula to get date from text string



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 10:26 PM posted to microsoft.public.excel.worksheet.functions
Sara
external usenet poster
 
Posts: 261
Default Formula to get date from text string

This is what the cell currently looks like:

[10/01/09 11:30PM]

I would like the formula to return only: 10/01/09

Does anyone know what formula I should use? Any help would be greatly
appreciated.

Thanks!!

Sara
  #2  
Old May 17th, 2010, 10:35 PM posted to microsoft.public.excel.worksheet.functions
Pete_UK
external usenet poster
 
Posts: 8,780
Default Formula to get date from text string

Here's one way:

=--MID(A1,2,8)

though this will only work if the date is in the normal format for
your region (does it mean 10th January 2009, or 1st October 2009 ?).

A safer way might be:

=DATE(2000+MID(A1,8,2),MID(A1,5,2),MID(A1,2,2))

or:

=DATE(2000+MID(A1,8,2),MID(A1,2,2),MID(A1,5,2))

depending on the answer to my earlier question.

Hope this helps.

Pete

On May 17, 10:26*pm, Sara wrote:
This is what the cell currently looks like:

[10/01/09 11:30PM]

I would like the formula to return only: 10/01/09

Does anyone know what formula I should use? Any help would be greatly
appreciated.

Thanks!!

Sara


  #3  
Old May 18th, 2010, 10:51 AM posted to microsoft.public.excel.worksheet.functions
Roger Govier[_8_]
external usenet poster
 
Posts: 338
Default Formula to get date from text string

Hi Sara

One way
=--INT((SUBSTITUTE(SUBSTITUTE(A11,"[",""),"PM]","")))

This will return the serial number of the date.
Format the cell in whatever date format you wish to see the result
--
Regards
Roger Govier

Sara wrote:
This is what the cell currently looks like:

[10/01/09 11:30PM]

I would like the formula to return only: 10/01/09

Does anyone know what formula I should use? Any help would be greatly
appreciated.

Thanks!!

Sara

 




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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.