Solved

How to extract a date (month) form a text string

Posted on 2012-04-11
24
357 Views
Last Modified: 2012-08-14
Dear Experts,
I need a formula which allows me to extract the month out of a text string and have the month in date format and also in text format
This is the text string: Split of expenses for January, 2012 and I need just "January"
I need this for a second formula which shall act based on this month...
thanks
Nils
0
Comment
Question by:Petersburg1
  • 8
  • 6
  • 5
  • +2
24 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37836189
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37836195
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836216
Try this ARRAY formula for cell A1

=TEXT(DATE(1,MAX(IF(ISERROR(FIND({"january";"february";"march";"april";"may";"june";"july";"august";"september";"october";"november";"december"},LOWER(A1))),FALSE,ROW(A1:A12))),1),"mmmm")
0
 

Author Comment

by:Petersburg1
ID: 37836244
Hi, thank you but I only get back December.....In Cell A I have the string and in Cell B I want to have the formula:
Cell A: "Split of expenses for January, 2012"
Cell B: "January"

thanks
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836253
Did you enter it as an array formula?

Select the formula cell
press F2
Press Ctrl-shift-enter
0
 

Author Comment

by:Petersburg1
ID: 37836256
Hi,
this formula e.g. (=MID(A1;23;7) does not fit as I have 12 such strings and the name of the month has a different length:
thanks

Split of expenses for January, 2012
Split of expenses for February, 2012
Split of expenses for March, 2012
Split of expenses for April, 2012
Split of expenses for May, 2012
Split of expenses for June, 2012
Split of expenses for July, 2012
Split of expenses for August, 2012
Split of expenses for September, 2012
Split of expenses for October, 2012
Split of expenses for November, 2012
Split of expenses for December, 2012
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836262
=SUBSTITUTE(A1,"Split of expenses for ","")
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836268
Or

=RIGHT(A1,LEN(A1)-22)
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836272
The first formula is useful if the rest of the text is not fixed.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 250 total points
ID: 37836275
For the month name only you can use

=MID(A1,23,LEN(A1)-28)
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836466
If your text string is always like:

Split of expenses for July, 2012

Then the formula becomes much simpler:

for the month as text (and the string is in B6):
=TEXT(LEFT(RIGHT(B6,LEN(B6)-LEN("Split of expenses for ")),LEN(RIGHT(B6,LEN(B6)-LEN("Split of expenses for ")))-6),"mmmm")

for the date:
=TEXT(LEFT(RIGHT(B6,LEN(B6)-LEN("Split of expenses for ")),LEN(RIGHT(B6,LEN(B6)-LEN("Split of expenses for ")))-6)  &" " & RIGHT(B6,4),"mmmm yyyy")

See attached.

Dave
stringToMonth-r1.xls
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37836503
How is that "much simpler" than Saqibh's?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37836523
I was referring to:
=MID(A1,23,LEN(A1)-28)

Hmm, it appears that the comment I was replying to has disappeared!
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836526
I see that, now, lol - And a TEXT conversion with minor manipulation will get to the date.

Kudo's Saqibh!

Dave
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836544
I was just going to check out the meaning of "Simpler" in the dictionary just in case I am missing something ;-)
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836549
ROLF

;)
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37836687
Who's Rolf? ;)
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836689
ROLF = "Rolling on the floor laughing"
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37836695
That would be ROFL, no?
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836704
Now, I'm really ROFL.  I'm going to bed.  Good night, All!
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37836707
Rolling on the "Laughing" floor
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37836708
Hasta mañana. :)
0
 
LVL 41

Expert Comment

by:dlmille
ID: 37836709
Reminds me of "Song of the South" (a 70's movie I think) - going to my "laughing place"
0
 

Author Closing Comment

by:Petersburg1
ID: 37836881
thank you
Nils
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now