Tackle 2024 with new knowledge – take advantage of Learnesys’ fall campaign on the All Courses package. Read more here.
In this lesson we will take a look at how to get the number of years, months, or days between two dates by using the DateDif function.
This function has three arguments: The two cells that we are comparing, and the denomination we want to use.
We’ll type Equals, DateDif, and select the two dates between which we want to find the difference. We first want to find the amount of years between them, so we’ll write a “y” within quotation marks.
The letter can be changed into an “m”, for months… or a “d” for days. For weeks, we can wrap the DateDif function for days in brackets, and divide the number we get by seven.
You can type in “yd” to ignore the years and get only the days between the dates. This can also be done for ignoring the years to get the amount of months using “ym” … And ignoring the months to get the amount of days using “md”.
The DateDif function is a hidden function, meaning that it does not show up as a suggestion in neither the tooltip… nor the insert function button.
In this lessen we have gone through the DATEDIF function.