# Google Sheets DATEDIF Function: Syntax, Examples & Tips

- URL: https://betteranalyst.com/google-sheets/datedif-function
- Author: Better Analyst

Formula Bot is now Better Analyst—same account, more powerful analysis.Formula Bot is now Better Analyst—same account and workflows, with more powerful analysis, dashboards, and automation.

[Learn what changed](https://betteranalyst.com/formula-bot-is-now-better-analyst)

The DATEDIF function calculates the difference between two dates in specified units (days, months, or years).

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

Generate FormulaExplain Formula

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Describe the DATEDIF you need in plain EnglishGenerate Formula

## Parameters

**`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.

## What is DATEDIF?

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.

## A Practical Example

Imagine you are managing employee records and need to calculate their ages based on their birth dates:

### Employee Table:

| 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.

## DATEDIF Formula

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.

## Result of the Formula

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.

## Why Use DATEDIF?

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.

## Key Takeaways:

- **DATEDIF**: A Google Sheets function that calculates the difference between two dates.
- **Flexible Units**: Can return differences in days, months, or years, depending on your needs.
- **Simplicity**: Provides an easy way to quantify time intervals without complex calculations.
- **Common Use Cases**: Ideal for age calculations, project timelines, and any scenario where date differences are relevant.

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!

## Example use case

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.

## Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

[Create Free Account](https://betteranalyst.com/signup)[Try Formula Generator](https://betteranalyst.com/excel-ai)

## Google Sheets how-to guides

- [How To Unhide Columns In Google Sheets](https://betteranalyst.com/google-sheets/how-to-unhide-all-columns-in-google-sheets)
- [How To Unhide Rows In Google Sheets](https://betteranalyst.com/google-sheets/how-to-unhide-all-rows-in-google-sheets)
- [How To Unprotect Google Sheets](https://betteranalyst.com/google-sheets/how-to-unprotect-google-sheets)
- [How To Wrap Text In Google Sheets](https://betteranalyst.com/google-sheets/how-to-wrap-text-in-google-sheets)
- [Google Sheets Conditional Formatting](https://betteranalyst.com/google-sheets/google-sheets-conditional-formatting)
- [How To Add A Column In Google Sheets](https://betteranalyst.com/google-sheets/how-to-add-a-column-in-google-sheets)
- [How To Alphabetize In Google Sheets](https://betteranalyst.com/google-sheets/how-to-alphabetize-in-google-sheets)
- [How To Autofit In Google Sheets](https://betteranalyst.com/google-sheets/how-to-autofit-in-google-sheets)

## Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

## Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

1. [01ChatGPTOpen a balanced comparison prompt in ChatGPT.](https://chatgpt.com/?prompt=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
2. [02ClaudeOpen the same research prompt in Claude.](https://claude.ai/new?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
3. [03PerplexityResearch the comparison with linked web sources.](https://www.perplexity.ai/search?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.
