In the previous post, we saw ‘How to Create a Drop-Down List in the Microsoft Excel?’, now we will learn about how to Calculate the Difference between Two Dates?.

Which Function to use?

When you want to calculate the difference between the two dates you can use the ‘DATEDIF’ function. First, put the start date in a cell and then the end date in another cell after that use the DATEDIF function to calculate the difference.


Syntax

DATEDIF(start_date,end_date,unit)


Arguments

start_date [Required]:

A date that represents the first, or starting date of a given period. Dates may be entered as text strings within quotation marks (for example, “2001/1/30”), as serial numbers (for example, 36921, which represents January 30, 2001, if you’re using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE(“2001/1/30”)).

Note: If the Start_date is greater than the End_date, the result will be  #NUM!.

end_date [Required]:

A date that represents the last, or ending, date of the period.

Unit:

The type of information that you want returned, where:

UnitReturns/Output
DThe number of days in the period. The difference in days.
MThe difference in months. The number of complete months in the period.
YThe difference in years. The number of complete years in the period.
YMThe difference between the months in start_date and end_date. The days and years of the dates are ignored
YDThe difference between the days of start_date and end_date. The years of the dates are ignored.
MDThe difference between the days in start_date and end_date. The months and years of the dates are ignored.

Understand With Example

Difference in Days

The “d” returns the number of full days between the two dates.

difference in days

Difference in Weeks

In this example, the start date is in cell C7, C8, and the end date is in D7, D8. The result in F7, F8. The “d” returns the number of full days between the two dates.  Divide it by /7 at the end. That divides the number of days by 7 since there are 7 days in a week. Note that this result also needs to be formatted as a number. Press CTRL + 1. Then click Number Decimal places: 2.

difference in weeks

Difference in Months

In this example, the start date is in cell C7, C8, & C9 and the end date is in D7, D8 & D9. The result is in cell F7, F8 & F9. the “m” returns the number of full months between the two days.

difference in months

Difference in Years

In this example, the start date is in cell C7, C8, & C9 and the end date is in D7, D8 & D9. The result is in cell F7, F8 & F9. The “y” returns the number of full years between the two days.

difference in years

Learn TallyPrime

How to Apply Filter in TallyPrime: CTRL + F
How to Apply Filter in Tally Prime: CTRL + F: In previous article we learned about "How To Create Multiple Ledgers in Tally Prime?" Now we will explore about how we can apply filter in Tally, and If you want to …
How To Create Multiple Ledgers in Tally Prime?
In this article, we will discuss that how we can create multiple ledgers in Tally Prime. If we create multiple ledgers then we can save our time on the other hand If we create a single ledger then it will …

For Latest Updates & Learning Join Our YouTube Channel: Join Now