Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Displaying a Number as Years and Months.

Displaying a Number as Years and Months

Written by Allen Wyatt (last updated November 18, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Robert has a formula that determines the payback period for certain investments. For instance, with $20,000 investment in energy-savings equipment and an annual energy savings of $3000, the simplistic payback period to recoup the investment is 6.6667 years. Robert wonders how he can make this payback period (6.6667) show as years and months instead of as a decimal number.

This can be done by simply multiplying the portion of the answer at the right of the decimal point by 12, which results in a number of months. Here is one way to get the desired result, assuming that the payback result is in cell A1:

=INT(A1) & " years / " & ROUNDUP((A1-INT(A1))*12,0) & " months"

With the value 6.6667 in cell A1, the formula would return "6 years / 8 months".

If you are using Microsoft 365, you also have access to the LET function. Using this you can make your formula more complex, but it ends up being more versatile. Here's an example:

=LET(A, ROUNDUP(A1*12,0)/12, Y, INT(A), M, ROUNDUP((A-Y)*12,0),
Y & IF(Y=1, " year", " years") & IF(M=0, " exactly", " / " &
M & IF(M=1, " month"," months")))

Even though I've shown the formula on three lines here, remember that it is a single, long formula. The LET function allow you to define variables that can be used in your formula. In this case, the pertinent variables being defined are Y (the number of years) and M (the number of months). The formula returns, in Robert's case, "6 years / 8 months" (just like the earlier formula), but it really shines if the number of months is 0 or 1. If it is 0, then the formula returns something like "6 years exactly", and if the number of months is 1, then it would return something like "6 years / 1 month" (note the lack of plural "months"). If will even handle "year" and "years" correctly.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12485) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Displaying a Number as Years and Months.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Inserting Endnotes

Endnotes appear at either the end of a section or the end of an entire document. It is just as easy to insert an endnote ...

Discover More

Getting Page Number Formatting Changes to Stick

Placing a page number into your document can be easy. Getting that page number to look the way you want it to can be more ...

Discover More

Inserting and Copying Rows

Want an easy way to insert a new row in a worksheet and copy everything from the row above? (You end up with two ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Deciphering a Coded Date

It is no secret that Excel allows you to work with dates in your worksheets. Getting your information into a format that ...

Discover More

Converting Coded Dates into Real Dates

Sometimes the format in which you receive data is not the same format that would be optimal for Excel. For instance, you ...

Discover More

Tombstone Date Math

Doing math with dates is easy in Excel. Doing math with old dates, such as those you routinely encounter in genealogy, is ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is one less than 9?

2023-11-18 15:41:44

J. Woolley

The Tip's formulas do not yield its reported results. The first formula should be corrected by using ROUND instead of ROUNDUP, so it becomes:
=INT(A1) & " years / " & ROUND((A1-INT(A1))*12,0) & " months"

Here is simpler version:
=INT(A1) & " years / " & INT(MOD(A1*12,12)) & " months"

The second formula should also be corrected by using ROUND instead of ROUNDUP (all on one line):
=LET( Y, INT(A1), M, ROUND((A1-Y)*12,0), Y & IF(Y=1, " year", " years") &
IF(M=0, " exactly", " / " & M & IF(M=1, " month"," months")))

Here is another version (all on one line):
=LET( Y, INT(A1), M, INT(MOD(A1*12,12)), Y & IF(Y=1, " year", " years") &
IF(M=0, " exactly", " / " & M & IF(M=1, " month"," months")))

And here is a simpler one based on Willy Vanhaelen's method for plural values (all on one line):
=LET( Y, INT(A1), M, INT(MOD(A1*12,12)), Y & LEFT(" years",4+Y) &
IF(M=0, " exactly", " / " & M & LEFT(" months",5+M)))

Finally, it is possible to specify a custom Fraction Number format for cell A1 instead of adding a text formula to another cell. This custom format
0 "and" 0/12 "yr"
will display 6.6667 as
6 and 8/12 yr


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.