Convert Yrs Mths to Mths in Excel

wsun

New Member
Joined
Sep 3, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Can someone pls help me with the formula or steps required to convert these values (xYrs, yMths) to Months in numerical format? For example "7 YEARS 1 MONTH" will be converted to "85". Thanks!
7 YEAR(S) 1 MONTH(S)
2 YEAR(S) 6 MONTH(S)
3 YEAR(S) 0 MONTH(S)
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,711
Office Version
  1. 2010
Platform
  1. Windows
My gut tells me there are probably better formulas than this, but this one works...

=12*REPLACE(A1,FIND(" ",A1),99,"")+REPLACE(LEFT(A1,LEN(A1)-9),1,FIND("R(",A1)+4,"")
 

wsun

New Member
Joined
Sep 3, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
You are a genius! It works, thanks!!!!
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,711
Office Version
  1. 2010
Platform
  1. Windows
As long as your years will never be greater than 99, here is a much shorter formula that will also work...

=12*LEFT(A1,2)+RIGHT(LEFT(A1,LEN(A1)-9),2)
 

wsun

New Member
Joined
Sep 3, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Super, thanks so much! :)
 

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,639
Another approach -- with fewer function calls and reference calls:

=SUBSTITUTE(SUBSTITUTE(A1," YEAR(S)","")," MONTH(S)","/12")*12
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,711
Office Version
  1. 2010
Platform
  1. Windows
Looks like the same number of function calls as I used in Message #4 to me; but, yes, only one reference as compared to three that my formula had. And very clever creating a fraction text string so that multiplying by 12 will create an expression that Excel can evaluate. I would also note that, while I doubt it will matter, your formula is not bound by the 99 year limit that my formula is.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,156
Messages
5,600,040
Members
414,357
Latest member
Gemma_R

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
Top