The DATEDIF function in Excel allows you to calculate the difference between two dates in terms of years, months, or days. Here are some examples:
To calculate the number of complete years between January 1, 2015, and March 1, 2021:
=DATEDIF("1/1/2015", "3/1/2021", "Y")
This formula returns the value 6.
To determine the number of completed months between September 15, 2020, and June 10, 2021:
=DATEDIF("9/15/2020", "6/10/2021", "M")
The result is 8 months.
To find out the age in years between July 20, 1985, and the current date:
=DATEDIF("7/20/1985", TODAY(), "Y")
This gives you the person’s age.
Remember, the DATEDIF function is quite handy for various date-related calculations.