Excel DATEDIF Function

The DATEDIF function in Microsoft Excel calculates the difference between two dates in years, months, or days. It is useful for age calculations, project durations, or time-based metrics.

Key Topics

Overview of DATEDIF Function

The DATEDIF function computes the interval between two dates using specified units (years, months, or days). Though not listed in Excel’s function wizard, it is widely used for precise date difference calculations.

DATEDIF Function Syntax

The syntax for the DATEDIF function is as follows:

Syntax: =DATEDIF(start_date, end_date, unit)

Parameters:

  • start_date: The earlier date (required).
  • end_date: The later date (required).
  • unit: The unit of time ("Y", "M", "D", "YM", "YD", "MD") (required).

Implementation Examples

Below are examples of how to use the DATEDIF function in different scenarios.

Example 1: =DATEDIF(B2, TODAY(), "Y") — Calculates years between B2 and today.

Example 2: =DATEDIF(B2, C2, "M") — Calculates months between B2 and C2.

Example 3: =DATEDIF(B2, TODAY(), "D") — Calculates days between B2 and today.

Sample Dataset (Excel-style View)

Below is a demo dataset styled like Excel, showing how the DATEDIF function can be used to calculate employee tenure in years.

A B C
1 Employee Hire Date Tenure (Years)
2 John 01/01/2020 =DATEDIF(B2, TODAY(), "Y")
3 Jane 06/15/2018 =DATEDIF(B3, TODAY(), "Y")
4 Alice 03/01/2021 =DATEDIF(B4, TODAY(), "Y")
5 Bob 11/10/2019 =DATEDIF(B5, TODAY(), "Y")
6 Emma 04/01/2022 =DATEDIF(B6, TODAY(), "Y")

Note: In the dataset, column C uses =DATEDIF(B2, TODAY(), "Y") to calculate the years between the hire date in B2 and the current date. The formula is applied to each row to show employee tenure.

Key Takeaways

  • The DATEDIF function calculates the difference between two dates in years, months, or days.
  • It supports units like "Y", "M", "D", "YM", "YD", and "MD" for precise intervals.
  • It is not listed in Excel’s function wizard but is fully supported.
  • Common uses include calculating age, tenure, or project durations.
  • The sample dataset demonstrates DATEDIF applied to calculate employee tenure.