Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Unique Date Displays.

# Unique Date Displays

by Allen Wyatt
(last updated January 22, 2018)

Jon requested help on how to subtract two dates and display the result such that the years were on the left of the decimal and the months on the right. Thus, if you subtracted January 7, 1985 from August 12, 2009, the result would be 24.7.

The easiest way to do this is to simply do your date subtractions as regular, and then use a custom format to display the result. For instance, if the lower date were in cell A2 and the higher date in B2, you could use the following formula in C2:

```=B2-A2
```

You would then follow these steps to format the display of the result in cell C2:

1. Select the cell. (In this case, cell C2.)
2. Choose Cells from the Format menu. Excel displays the Format Cells dialog box.
3. Make sure the Number tab is selected.
4. In the Category list, at the left side of the dialog box, choose Custom. (See Figure 1.)
5. Figure 1. The Number tab of the Format Cells dialog box.

6. In the Type box, at the left of the dialog box, enter the following format: yy.m
7. Click on OK.

The result is that C2 shows the number of years to the left of the decimal and the number of months to the right. The problem with this is that it will always vary the number of months from 1 to 12, rather than 0 to 11, as one would expect if you were looking for elapsed months.

To overcome this, you could enter the following formula in cell C2:

```=(YEAR(B2)-YEAR(A2))+(MONTH(B2)-MONTH(A2))/100
```

This formula returns the number of years on the left of the decimal and the number of months on the right. The months are always expressed using two decimal places, however. If you wanted to make sure that the months were expressed with no leading zeros, then you would use this formula variation:

```=VALUE(ABS(YEAR(B2)-YEAR(A2)) & "." & ABS(MONTH(B2)-MONTH(A2)))
```

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2182) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Unique Date Displays.

##### 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

Locking All Non-Empty Cells

Need to make sure that your worksheet is locked, with only the blank cells accessible to editing? You can do this easily ...

Discover More

Wrong Values Merged from Excel

When you use an Excel workbook as a data source for your merged document, you may be surprised if what is merged doesn't ...

Discover More

Karen is having problems getting hyperlinks to print in a document on her home computer. There are only a limited number ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

Specifying Different Weekends with NETWORKDAYS

The NETWORKDAYS worksheet function can be used to easily determine the number of work days (Monday through Friday) within ...

Discover More

Excel allows you to perform quite a few operations using dates in your worksheet. Sometimes, however, the answer may not ...

Discover More

Working with Elapsed Time

Work with times in a worksheet and you will eventually want to start working with elapsed times. Here's an explanation of ...

Discover More
##### Subscribe

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

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}] 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 six more than 8?

2013-06-10 10:31:38

Scott Renz

I tried this modification to the formula and it seemed to get it right:

=TRUNC((B2-A2)/365.25) & "." & TRUNC(( ((B2-A2)/365.25)-TRUNC((B2-A2)/365.25))*12)

2013-06-10 10:06:00

Scott Renz

I used my birthday and today's date.

2013-06-10 10:04:59

Scott Renz

I tried the last formula. It shows the year part as one year more than what I am and the month part 1 or 2 months (depending on how you round) less than what it should be

##### This Site

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