Solved

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

Posted on 2012-04-11
24
368 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

738 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