Excel: Calculating days, months, and years

One thing I find myself needing to do on a relatively regular basis, is calculate the number of days, months, or years between two given dates. Like with so many other things, Excel has a function for this, too. It’s intuitively named DATEDIF, and here’s how you use it.

The syntax is =DATEDIF(startdate,enddate,UNIT). The units are D for days, M for complete months, and Y for complete years, and here’s how it looks in use:

In addition to those three unit variants, you can also calculate the months or days between the dates, ignoring the years and dates or months as the case might be, using the units “YM” to count months, and “YD” to count days. Here’s how that looks:






By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.

This site uses Akismet to reduce spam. Learn how your comment data is processed.