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)
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,"")
 
Upvote 0
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)
 
Upvote 0
Another approach -- with fewer function calls and reference calls:

=SUBSTITUTE(SUBSTITUTE(A1," YEAR(S)","")," MONTH(S)","/12")*12
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,194
Members
448,951
Latest member
jennlynn

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