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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Extract Month From A Text String



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2010, 02:25 PM posted to microsoft.public.excel.misc
George
external usenet poster
 
Posts: 883
Default Extract Month From A Text String

Good Day,

I have a date that I'm pulling from a report that is in a text string
format. What i need to be able to do is extract the month from the string so
that I can run a script against the month name. The format of the string is
as follows.

Wednesday, April 14, 2010

Thanks in advance for your help.
Sam
  #2  
Old May 11th, 2010, 02:37 PM posted to microsoft.public.excel.misc
Mike H
external usenet poster
 
Posts: 8,419
Default Extract Month From A Text String

Hi,

Maybe this

= MID(A1, FIND(" ",A1,1)+1, FIND(" ",A1,FIND(" ",A1,1)+1)-(FIND("
",A1,FIND(" ",A1,1))))
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"George" wrote:

Good Day,

I have a date that I'm pulling from a report that is in a text string
format. What i need to be able to do is extract the month from the string so
that I can run a script against the month name. The format of the string is
as follows.

Wednesday, April 14, 2010

Thanks in advance for your help.
Sam

  #3  
Old May 11th, 2010, 02:42 PM posted to microsoft.public.excel.misc
Bernard Liengme
external usenet poster
 
Posts: 516
Default Extract Month From A Text String

=MID(A1,FIND(",",A1)+2,FIND(" ",A1,FIND(",",A1)+2)-FIND(",",A1)-2)
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"George" wrote in message
...
Good Day,

I have a date that I'm pulling from a report that is in a text string
format. What i need to be able to do is extract the month from the string
so
that I can run a script against the month name. The format of the string
is
as follows.

Wednesday, April 14, 2010

Thanks in advance for your help.
Sam


  #4  
Old May 11th, 2010, 02:46 PM posted to microsoft.public.excel.misc
George
external usenet poster
 
Posts: 883
Default Extract Month From A Text String

Hey Guys,

Thanks for the quick response...It's exactly what I needed and works
perfectly..

George

"Bernard Liengme" wrote:

=MID(A1,FIND(",",A1)+2,FIND(" ",A1,FIND(",",A1)+2)-FIND(",",A1)-2)
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"George" wrote in message
...
Good Day,

I have a date that I'm pulling from a report that is in a text string
format. What i need to be able to do is extract the month from the string
so
that I can run a script against the month name. The format of the string
is
as follows.

Wednesday, April 14, 2010

Thanks in advance for your help.
Sam


  #5  
Old May 12th, 2010, 01:18 AM posted to microsoft.public.excel.misc
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Extract Month From A Text String

On Tue, 11 May 2010 06:25:01 -0700, George
wrote:

Good Day,

I have a date that I'm pulling from a report that is in a text string
format. What i need to be able to do is extract the month from the string so
that I can run a script against the month name. The format of the string is
as follows.

Wednesday, April 14, 2010

Thanks in advance for your help.
Sam


Assuming the text string is always the entire contents of the line, and is
always formatted as
dddd, mmmm dd, yyyy
or
dddd, mmmm d, yyyy

Then
=--MID(A1,FIND(",",A1)+2,99)
or
=DATEVALUE(MID(A1,FIND(",",A1)+2,99))

will return a number which is the Excel Date. (40282 for the above date).

You can then extract the month as a number [1-12] using the MONTH worksheet
function:

=MONTH(--MID(A1,FIND(",",A1)+2,99))

If you want the month as text, then:

=TEXT(--MID(A1,FIND(",",A1)+2,99),"mmmm")

--ron
 




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 07:14 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.