How to Calculate the Difference between Two Dates?

2 minutes, 32 seconds Read

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

Advertisements

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 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 …
TallyPrime: Important Shortcut Key ALT + G or GO To
In this article, we will discuss the new and unique shortcut key ALT + G or GO To in the TallyPrime. With the help of the ALT + G shortcut key, you can navigate in tally anywhere. ALT + G …

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

author

EduTaxTuber Team

We are here to help for every updates related to everything...👍📙👍📗

Similar Posts

Leave a Reply

Realme 10 Pro and 10 Pro+ Launched RBI Monetary Policy Highlights England vs Senegal: FIFA World Cup 2022 No Curfew in Mumbai: Section 144 Imposed to ensure Peace Elon Musk suspends Kanye West Twitter Account for inciting violence