# DATEDIF

The DATEDIF function calculates the difference between two dates in days, months, or years. It is a hidden function in Excel that is useful for determining the duration between two dates in various date units.

Try out DATEDIF

Example explanation
This spreadsheet uses the DATEDIF function to calculate the number of days between two dates in cell D3 and the number of years since a birth date in cell B7.

## Syntax ðŸ”—

=DATEDIF(`start_date`, `end_date`, `unit`)

When you need to swiftly find out how many days, months, or years lie between two dates, turn to the concealed gem in Excel known as DATEDIF. This function offers a direct solution to determining the time span between any two given dates, streamlining your date-based calculations effortlessly. Whether it's for project timelines, age calculations, or any scenario requiring date differentials, DATEDIF is your go-to tool for quick date computations. Simply input the start date, end date, and specify the desired time unit (days, months, or years), and let Excel handle the rest with precision and ease.

## Examples ðŸ”—

Calculate the number of days between January 1, 2022, and June 30, 2022: =DATEDIF('01/01/2022', '06/30/2022', 'd')

Determine the number of months between September 15, 2020, and June 10, 2021: =DATEDIF('09/15/2020', '06/10/2021', 'm')

Find out the age in years between July 20, 1985, and the current date: =DATEDIF('07/20/1985', TODAY(), 'y')

## Notes ðŸ”—

The DATEDIF function is a hidden function, so it won't appear in the Excel functions list. You can type it directly into a cell to use it. The 'unit' parameter is case-sensitive: 'd' for days, 'm' for months, and 'y' for years.

## Questions ðŸ”—

Is the DATEDIF function available in the standard list of Excel functions?

No, the DATEDIF function is a hidden function in Excel, so it doesn't show up in the regular list of functions. However, you can still use it by typing it directly into a cell.

What happens if the 'start_date' is after the 'end_date' in the DATEDIF function?

If the 'start_date' is later than the 'end_date', the DATEDIF function will return a negative value, indicating the difference is a negative duration.

Can I use cell references for the 'start_date' and 'end_date' in the DATEDIF function?

Yes, you can use cell references that contain date values for the 'start_date' and 'end_date' parameters in the DATEDIF function, making it dynamic and adaptable to changing dates.

YEARFRAC
NETWORKDAYS
WORKDAY
EDATE
EOMONTH