Formula to Extract Month and year

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,601
Office Version
  1. 2021
Platform
  1. Windows
I have the following text in cell F10 "11/02P YTD" The 11 represents the year (2011) and 02 represent the month (Feb)

I would like a formula in F20, that will extract the month and year to appear as Feb 2011 from cell F10

Your assistance will be most appreciated
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi Andrew

Thanks for the reply. I have used your formula and formatted the cell as mmm yyyy and I get #value!

It would be appreciated if you could assist
 
Upvote 0
My formula worked when I tried it. It returns the string 2011/02/01 which is coerced into a date by adding zero. This also worked:

=TEXT((20&LEFT(F10,5)&"/01"),"yyyy/mm/dd")+0
 
Upvote 0
Hi Andrew

I found where the problem was. This was an old Lotus workbook that was converted into Excel several years ago. I unchecked the Lotus compatibility settings and the formula works perfectly

I only need one small amendment. I need the month to change each time "11/02P YTD, the text 02 changes for eg when the text in F10 changes to 11/03 then the result of the formula must read March
 
Upvote 0
I only need one small amendment. I need the month to change each time "11/02P YTD, the text 02 changes for eg when the text in F10 changes to 11/03 then the result of the formula must read March

That will happen automatically with the formula I posted.
 
Upvote 0
Hi Andrew

The result of the current formula gives me Jan 2011, it should give me Feb 2011, based on the text in cell F10 "11/02P YTD". If the text changes to "11/03P YTD", then the resdultt must read March 2111 etc
 
Upvote 0
For me the formula returns Feb 2011, because the date is returned as yyyy/mm/dd. I wonder if its a Regional Setting issue?
 
Upvote 0
Hi Andrew

I live in South Africa and we format our dates dd/mm/yyyy for eg 01/02/2011 being Feb 2011
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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