Who doesn’t love juicy office gossip? Well, do I have a secret to tell you about dates. It’s DATEDIF, Excel’s best-kept secret that calculates the time between two dates. (It’s a secret because it only appears when you manually type out the function in Excel.)
DATEDIF returns the number of days, months, or years between two dates depending on what unit you input into the formula. Just follow the syntax below:
=DATEDIF(start_date, end_date, unit)
- Start_date represents the start date of the period.
- End_date represents the end date of the period.
- Unit defines the time in years, months, or days. A “Y” represents years, “M” represents months, and “D” represents days.
Take a look at the example above. To calculate how many years each project took, I used DATEDIF and entered the project start date as the start_date argument, the project end date as the end_date argument, and “Y” as the unit argument to return the number of years between the start and end dates.
And if you want to calculate months or days instead, just change the unit to “M” or “D.” That’s it! Now it’s your turn to share the secret. XOXO, Excel Girl.