Calculating date differences in Excel using DATEDIF

If you work with Excel spreadsheets, you’ve likely ended up with the need to compare two dates to find the number of days, months, or years between them. Using the DATEDIF function, you can easily accomplish that.

Here’s a spreadsheet that has two dates in cells A2 and B2. Using the DATEDIF function, we get the year difference (cell C2), the month difference (cell D2), and day difference (cell E2):

excel-datedif-20170911-1

To calculate the year difference, we create the formula =DATEDIF(A2, B2, “Y”), where A2 and B2 are the dates, and “Y” says to calculate the year difference:

excel-datedif-20170911-2

To calculate the month difference, we create the formula =DATEDIF(A2, B2, “M”), where A2 and B2 are the dates, and “M” says to calculate the month difference:

excel-datedif-20170911-3

To calculate the day difference, we create the formula =DATEDIF(A2, B2, “D”), where A2 and B2 are the dates, and “D” says to calculate the day difference:

excel-datedif-20170911-4

In cell F2, we also show how you can just subtract one date from another to get the difference in days by using a formula of =B2-A2:

excel-datedif-20170911-5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s