Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-04-11
24
Medium Priority
?
378 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1000 total points
ID: 37836275
For the month name only you can use

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

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
 
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 42

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 42

Expert Comment

by:dlmille
ID: 37836549
ROLF

;)
0
 
LVL 85

Expert Comment

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

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 42

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 42

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
Quickbooks hosting can do wonders to your enterprise but considering the points elaborated in the article which will help you to better analyze the outcomes. So scan your business, its needs and then move to the new world of limitless benefits.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

916 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