Calculate the Difference between Two Dates Dynamically

This blog post will explain to you how to Calculate the Difference between Two Dates Dynamically.

Here we have two date columns, one is start_date and another one is end_date.

And we need to calculate the total number of days between these two dates.

Here we will use two different Excel Function.

1. Excel DAYS Function
2. Excel DATEDIF Function

With the help of these two Excel functions, we will calculate the number of days between two dates here.

This Excel function can only calculate the total number of days between two dates.

And if you want to find the difference in terms of months or years, then this is not going to work.

This function has two parameters, end_date, and start_date.

See the image below:-

These are the two parameters of the Excel DAYS function.

End_date:- drag end_date cell reference here

Start_date:- drag start_date cell reference here

See the image below:-

Note: – This function has the first parameter as end_date, and the second parameter as start_date, which means we will enter our end_date first and then start_date.

And close the bracket and press enter.

See that the number of days is calculated in the next column.

Now if we want to apply the same formula for the rest of the cells also, then we need to copy the formula and paste it into the rest of the cells under the ‘Number of Days’ column.

Or you can drag the formula cell to the end, as you can see in the image.

So this one is the simple and easy method to find the number of days between two dates.

Now we will move to the next function.

Excel DATEDIF Function – Calculate the Difference between Two Dates

This function has more options as compared Excel DAYS Function.

This function has three parameters.

Start_date, End_Date, “D” – If we want to get the result in terms of days.

Start_date, End_Date, “M” – If we want to get the result in terms of months.

Start_date, End_Date, “Y” – If we want to get the result in terms of years.

So this function is more useful.

With the help of the Excel DATEDIF Function, we will calculate the number of days first.

Use the formula as appears in the above image.

For calculating the number of days, we will use “D” as the third parameter here and close the bracket, and press Enter.

Note: – This function has the first parameter as start_date and send parameter as end_date, just the opposite of the Excel DAYS function.

Now we will calculate the number of months between the two dates.

So we will use the Excel DATEDIF function as follows, see in the image below:-

See in the image that we are using the third parameter “M”, to calculate months here.

And close the bracket and press Enter.

See the result.

And last, calculate the total number of ‘years’ between two given date ranges.

Use the Excel DATEDIF function as follows:-

Here we have used our third parameter as “Y” for the year, as we want to calculate our difference between two dates in the form of a year.

Again close the bracket and press Enter.

See the result below image:-

Now, this is the difference between two dates in form of the number of days, months, and years.

To apply the same formula to the rest of the cells, select all three cells where we have applied the Excel DATEDIF Function. Copy it, and paste it into the rest of the cells.

Or we can select all three cells where we have applied the formula and drag it till the end of the last cell.

See the image below:-

Copy this selected area and paste into the rest of the area or drag it to the end.

See in the above image, all the required values are found.

You can see here, the difference between the two dates is in the form of days, months, and even years.

I suggest you use a cell reference to enter start_date or end_date in the formula. You can drag it dynamically to get the result in other cells.

So I hope you find this tutorial useful.

Other Useful Post

3 Easy Methods to Transpose Data in Excel (Step-by-Step Guide)

9 Different Ways to Create New Sheets in Excel VBA

How to Convert Excel Files to CSV Format File

How to Create Search Box in Excel (No VBA Code Required)

How to Add Plus Sign (+) Before Positive Number in Excel

How to Lock / Protect Formula Part Only In Excel (A Detailed Guide)

How to Split Cells Diagonally in Excel (Step by Step Guide)

How to Remove Formulas and Keep the Values in Excel (4 Quick Ways)

3 Easy Ways to Select the Visible Cells Only In Excel

How to Highlight Every Other Row or Column in Excel