Excel's secret function

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.

Related Video

Back to blog

Meet Emma

Emma is the founder of Excel Dictionary, your ultimate source for impactful, digestible Excel tips and tricks.  After graduating from The Ohio State University in 2019 with a degree in Actuarial Science, Emma began her professional career as an actuary, just in time for COVID to hit.  New to the industry, new to the company, adjusting to a new WFH environment, and new to Excel, Emma quickly realized how overwhelming those Excel projects could be and didn’t know where to turn for help – so she taught herself.

Emma created Excel Dictionary to help others avoid Excel overwhelm and to be the coworker that you can turn to.  She was recently awarded the Microsoft MVP award and has built a community of over 5 million people across the globe! Join her across all social channels to learn quick, actionable skills that will make you more efficient, comfortable, and confident in your daily work!

Follow Emma