Solved

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

Posted on 2012-04-11
24
365 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Outlook Free & Paid Tools
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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…
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…

808 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