DATEDIF(start_date, end_date, unit)One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
start_date:
The starting date from which to begin the calculation. This can be a date value, a cell reference containing a date, or a formula that returns a date.
end_date:
The ending date up to which to calculate the difference. This can also be a date value, a cell reference containing a date, or a formula that returns a date.
unit:
The unit of time in which to express the difference between the two dates. This can be "Y" for years, "M" for months, "D" for days, "MD" for the difference in days ignoring months and years, "YM" for the difference in months ignoring years, or "YD" for the difference in days ignoring years.
The DATEDIF function in Google Sheets is a useful tool for calculating the difference between two dates. It allows you to find the difference in days, months, or years, making it an essential function for anyone who needs to analyze time intervals in their data. The function is particularly helpful for tracking age, project timelines, or any scenario where understanding the duration between two dates is crucial.
In simpler terms, DATEDIF helps you quantify the time that has passed between two specific dates in a straightforward manner.
Imagine you are managing employee records and need to calculate their ages based on their birth dates:
| EmployeeID | Name | BirthDate |
|---|---|---|
| 1 | John Doe | 1990-05-15 |
| 2 | Jane Smith | 1985-08-22 |
| 3 | Bob Brown | 2000-01-30 |
You want to find out how old each employee is as of today.
To achieve this, you would use the DATEDIF function as follows:
=DATEDIF(B2, TODAY(), "Y")In this formula:
B2 is the cell containing the BirthDate of the employee.TODAY() returns the current date."Y" specifies that you want the difference in complete years.When you apply the DATEDIF formula to the Employee Table, the output would look like this:
| EmployeeID | Name | BirthDate | Age |
|---|---|---|---|
| 1 | John Doe | 1990-05-15 | 33 |
| 2 | Jane Smith | 1985-08-22 | 38 |
| 3 | Bob Brown | 2000-01-30 | 23 |
In this case, the DATEDIF function calculates the age of each employee based on their birth date and the current date.
DATEDIF is beneficial because it simplifies the process of calculating date differences without the need for complex formulas. It provides a straightforward way to extract meaningful information from date data, making it easier to analyze time-related metrics. Additionally, it allows for flexibility in specifying the unit of measurement (days, months, or years), enhancing its usability.
DATEDIF is an essential function for anyone working with dates in Google Sheets, providing a powerful way to enhance data analysis and reporting capabilities.
Happy spreadsheeting!
You have a table with employee start dates in Column A and today's date in Column B. Use DATEDIF to calculate the tenure of each employee in years. This helps HR track employee longevity and plan for anniversaries or retention strategies efficiently.
Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.
Browse our complete library of Google Sheets formula guides
Compare your options
Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.
AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.