Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-04-11
24
Medium Priority
?
375 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

671 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