View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Extracting dates from a String

I think you need to give us a little more information about the structure of
these text strings of yours. Is the month name **always** spelled out? Is
the year **always** a 4-digit number? Is the only character between date
parts the space character (that is, a comma is **never** used between the
day and the year)? Is the word "to" **always** used to separate the two
dates and, if not, can the text separating them be more than one word long?
Could there other numbers before the first date?
--
Rick (MVP - Excel)


"Rajendra" wrote in message
...
On Oct 7, 9:03 pm, Al wrote:
Try for start date:
=MID(A1,FIND("period",A1)+7,(FIND("to",A1))-(FIND("period",A1)+8))

Stop date:
=MID(A1,FIND("to",A1)+3,(FIND("-",A1))-(FIND("to",A1)+4))

HTH



"Raj" wrote:
Hi,


Cells in Column A have strings of the following type:
eg A1:
Billing for the period March 14 2009 to March 13 2010 - Order dated
April 01 2009
In B1 I want the date : 14-Mar-2009
In C1 I want the date: 13-Mar-2010
(to elaborate, only the first two dates in the string need to be
extracted, third and subsequent dates in the string to be ignored)


Thanks in advance for the help.


Regards,
Raj- Hide quoted text -


- Show quoted text -


Thanks. While that worked right for the given string, it did not work
for all the rows as the strings are composed differently. The word
"period" does not precede the first date at all times nor does the "-"
suceed the second date. Is there a way to extract the first two dates
by looking for the first and second occurrences of the standard "mmmm"
months in the String and then compute the dates based on the position
of those strings?

Regards
Raj