Gabriel Ideas Written by Gabriel

Google Sheets Date Diff Formula: Days Between Two Dates

By Gabriel Aug 06, 2026
the datedif function calculator is displayed in this screenshot from microsoft
the datedif function calculator is displayed in this screenshot from microsoft

Calculating the number of days between two dates is a common task in Google Sheets, essential for understanding time intervals in projects, events, or personal agendas. While Google Sheets doesn't have a built-in formula for this, we can achieve this using simple arithmetic and the DATEDIF function.

the datedif function calculator is displayed in this screenshot from microsoft
the datedif function calculator is displayed in this screenshot from microsoft

The DATEDIF function in Google Sheets calculates the difference between two dates based on a specified unit. However, DATEDIF is not as straightforward as one might hope when it comes to finding the number of days. Still, with a little creativity, we can indeed calculate the number of days between two dates.

Date Functions In Google Sheets DATE, DAY, MONTH, YEAR Formulas Part-2
Date Functions In Google Sheets DATE, DAY, MONTH, YEAR Formulas Part-2

Understanding the DATEDIF Function in Google Sheets

Before we dive into calculating the difference in days, it's crucial to understand the DATEDIF function's syntax and units of measurement.

How to use DATE, DAY, MONTH Function in Google sheets with examples.
How to use DATE, DAY, MONTH Function in Google sheets with examples.

DATEDIF(start_date, end_date, unit) where:

  • start_date: The starting date (e.g., "2022-12-31").
  • end_date: The ending date (e.g., "2023-01-15").
  • unit: The unit of measurement. DATEDIF supports "D" for days, "M" for months, and "Y" for years. For our use-case, we're interested in "D".
Date Calculator Spreadsheet | Add Days, Weeks, Months, Years & Hours | Google Sheets Template | Countdown and Future Date Tool
Date Calculator Spreadsheet | Add Days, Weeks, Months, Years & Hours | Google Sheets Template | Countdown and Future Date Tool

Limitation of DATEDIF with Days

When using "D" as the unit in DATEDIF, it doesn't return the exact number of days. Instead, it provides the number of whole days, ignoring the fraction. For example:

DATEDIF("2022-12-31", "2023-01-01", "D")= 0
DATEDIF("2022-12-31", "2023-01-02", "D")= 1
How to Sort by Date in Google Sheets
How to Sort by Date in Google Sheets

As you can see, DATEDIF doesn't account for the partial day on January 1, 2023.

Adjusting the DATEDIF Formula for Days

To accurately calculate the number of days, we need to modify the DATEDIF formula. The trick is to use the EDATE function, which adjusts the start date by the specified number of months.

a green and white sign that says day function returns the day of the month as a number between 1 and 3 bed on a given date
a green and white sign that says day function returns the day of the month as a number between 1 and 3 bed on a given date

Here's the formula to calculate the number of days between two dates in Google Sheets:

=EDATE(end_date, start_date) - start_date + 1

How to Calculate Due Dates with Google Sheets
How to Calculate Due Dates with Google Sheets
Master the YEARFRAC Function in Google Sheets: Effortlessly Calculate Years Between Two Dates!
Master the YEARFRAC Function in Google Sheets: Effortlessly Calculate Years Between Two Dates!
6 Crazy Google Sheets Formulas You Should Know
6 Crazy Google Sheets Formulas You Should Know
How to Sort by Date in Google Sheets
How to Sort by Date in Google Sheets
How to Sort By Date in Google Sheets
How to Sort By Date in Google Sheets
How to Use the EDATE Function in Google Sheets
How to Use the EDATE Function in Google Sheets

Let's break this down:

  1. EDATE(end_date, start_DATE + 1): Adjusts the end_date by one month from the start date.
  2. end_date: Returns the original end_date.
  3. start_date: Subtracts the start_date from the adjusted end_date and adds 1 to account for the missing day.

Alternative Formula using the NETWORKDAYS Function

Another approach to calculate the number of days between two dates involves the NETWORKDAYS function. NETWORKDAYS counts the number of whole workdays between two dates, excluding weekends. However, it doesn't include the starting date, so we need to adjust it accordingly.

Here's the formula to calculate the number of total days using NETWORKDAYS:

=NETWORKDAYS(start_date, end_date) + 1

Adjusting for Holidays using the NETWORKDAYS Function

If you need to account for holidays as well, you can use the NETWORKDAYS.INTL function, which allows you to specify both the weekend days and holidays.

The formula would look like this: =NETWORKDAYS.INTL(start_date, end_date, [weekend_days], [holidays]) where:

  • [weekend_days]: An array of numbers representing the weekend days (e.g., {7, 14} for Saturday and Sunday).
  • [holidays]: A range of cells containing the holiday dates.

Remember to adjust the formulas to match your specific range and dates.

Using the ARRAYFORMULA Function

If you want to calculate the number of days between two dates for multiple cells or a range of cells, use the ARRAYFORMULA function to apply the formula to each cell in the range.

The formula would look like this: =ARRAYFORMULA(EDATE(end_date_range, start_date_range) - start_date_range + 1)

No matter your approach, calculating the number of days between two dates in Google Sheets requires a combination of functions and a touch of creativity. With these formulas, you can effectively determine time intervals for any purpose.

Now that you've mastered calculating the difference in days, explore other Google Sheets functions to enhance your productivity and analytics capabilities. Happy calculating!