Copy month and year text only from long sentence text

lakshmipathi123

Board Regular
Joined
Jul 10, 2012
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hi Experts,

I need copy only month and year text from below sentence. I tried with left, right, and mid function but month and year place changes.


Hyd Inorbit Mall - 1315 - JUN20-REVENUE SHARE
Provision for Revenue Rent - Sep'20
63013-JUN'20 Being revenue rent for Jallandar store
 
Not surprising there are errors as this is different data and a different requirement - which makes it quite a different problem! ;)


.. and sometimes "-" which was not mentioned before.

Also, my previous suggestion was based on your original samples from which I made the assumption


In any case, try this

lakshmipathi123.xlsm
AB
1Hyd Inorbit Mall - 1315 - JUN20-REVENUE SHAREJUN20
2Provision for Revenue Rent - Sep'20Sep20
363013-JUN'20 Being revenue rent for Jallandar storeJUN20
463013-APR-19 TO MAR-20APR19 TO MAR20
5Pune - HC - JUL20 TO SEP20JUL20 TO SEP20
6Provision for Dec-20||Dec 20||1434||63013Dec20
MonthYear (3)
Cell Formulas
RangeFormula
B1:B6B1=LET(x,LEFT(SUBSTITUTE(SUBSTITUTE(MID(A1,SEQUENCE(LEN(A1)),6),"'"," "),"-"," "),6),y,IF(ISNUMBER(DATEVALUE(1&x)),IF(ISNUMBER(SEARCH(LEFT(x,3),"janfebmaraprmayjunjulaugsepoctnovdec")),x,""),""),TEXTJOIN(" TO ",1,UNIQUE(SUBSTITUTE(FILTER(y,y<>"","")," ",""))))


BTW, thanks for updating your profile. (y)
Peter - Thanks a lot for your quick response. Formula working like a charm :) Many thanks your help.

Grateful if you could help me in fixing below requirement as well.

In addition to above, one more separate request similar to my earlier question. I just need to copy 5 digits account number (always numeric) from the following sentences

1) Provision for Dec-20||Dec 20||1434||63013 - Need to capture only "63013" (any 5 digit numeric account)
2) 63001-APR-19 TO MAR-20 - Need to capture and copy only "63001"

Thanks,
Lakshmipathi
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
An alternative one, try this at B1,
=TEXTJOIN(" TO ",TRUE,IFERROR(UPPER(MID(SUBSTITUTE(SUBSTITUTE($A1,"-",""),"'",""),SORT(SEARCH({"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"},SUBSTITUTE(SUBSTITUTE($A1,"-",""),"'",""))),5)),""))

To extract the 5 digits account number, try this at C1,
=IFERROR(MID($A1,FIND("11111",TEXTJOIN("",TRUE,IFERROR(IF(MID($A1,SEQUENCE(1,LEN(A1),1,1),1)+0>=0,1),"-"))),5),"")
 
Upvote 0
I just need to copy 5 digits account number
This suggestion, as with KP117's suggestion assumes that there will not be numeric sequences of more than 5 digits in the text being evaluated.

lakshmipathi123.xlsm
AC
1Acc. No.
2Hyd Inorbit Mall - 1315 - JUN20-REVENUE SHARE 
3Provision for Revenue Rent - Sep'20 
463013-JUN'20 Being revenue rent for Jallandar store63013
563013-APR-19 TO MAR-2063013
6Pune - HC - JUL20 TO SEP20 
7Provision for Dec-20||Dec 20||1434||6301363013
MonthYear (3)
Cell Formulas
RangeFormula
C2:C7C2=MID(A2,FIND(11111,CONCAT(--ISNUMBER(MID(A2,SEQUENCE(LEN(A2)),1)+0))&211111),5)
 
Upvote 0
This suggestion, as with KP117's suggestion assumes that there will not be numeric sequences of more than 5 digits in the text being evaluated.

lakshmipathi123.xlsm
AC
1Acc. No.
2Hyd Inorbit Mall - 1315 - JUN20-REVENUE SHARE 
3Provision for Revenue Rent - Sep'20 
463013-JUN'20 Being revenue rent for Jallandar store63013
563013-APR-19 TO MAR-2063013
6Pune - HC - JUL20 TO SEP20 
7Provision for Dec-20||Dec 20||1434||6301363013
MonthYear (3)
Cell Formulas
RangeFormula
C2:C7C2=MID(A2,FIND(11111,CONCAT(--ISNUMBER(MID(A2,SEQUENCE(LEN(A2)),1)+0))&211111),5)
Thank you, Peter :) Its all set now.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top