Google Sheets DATEDIF Function

This post will guide you how to use Google Sheets DATEDIF function with syntax and examples.

Description


The Google Sheets DATEDIF returns the number of days, months, or years between tow dates.

The DATEDIF function can be used to calculate the date between a start date and an end date in year, month or days. The purpose of this function is to get days, months or years between two given dates and its returned values is a number.

The DATEDIF function is a build-in function in Google Sheets and it is categorized as a Date function.

Syntax


The syntax of the DATEDIF function is as below:

=DATEDIF (start_date,end_date,unit)

Where the DATEDIF function arguments are:

  • Start_date – The start date to consider in the calculation. It can be a cell reference that containing a DATE value, or a number.
  • End_date – the end date to consider in the calculation. It must be a cell reference that containing a DATE value or a number.
  • Unit the type of information that you want to return.

Note:

  • The index_num value must be a number between 1 and 29. The DATEDIF function can accpet Unit values are "Y","M","D" ,"MD","YM","YD".
    • “Y”– The number of complete years
    • “M”– The number of complete months
    • “D”– The number of days
    • “MD”– The difference between the days in start_date and end_date.
    • “YM”– The difference between the months in start_date and end_date
    • “YD”– The difference between the days (the years of dates are ignored)
  • If Start_date is greater than the end_date, the DATEDIF will return a #NUM! error message. You can trap this error with the IFERROR function in combination with the DATEDIF function.

Google Sheets DATEDIF Function Examples


The below examples will show you how to use google sheets DATEDIF Function to return the difference between two dates.

#1 =DATEDIF(B1,B2,”Y”)
google sheets dateif function1

Note: the above google sheets formula will return the number of complete year as “1” between start_date (10/1/2020) and end_date(11/15/2021).

#2 =DATEDIF(B1,B2,”D”)
google sheets dateif function1

Note: the above formula will return the number of days (410) between 10/1/2020 and 11/15/2021.

#3 =DATEDIF(B1,B2,”YD”)
google sheets dateif function1

Note: the above formula will return 45 days between 10/1 and 11/15, ignoring the years of dates.

 

Related Posts

Google Sheets WEEKDAY Function
google sheet weekday function1

This post will guide you how to use Google Sheets WEEKDAY function with syntax and examples. Description The Google Sheets WEEKDAY function returns an integer value representing the day of the week for a given date and the value is ...

Google Sheets TIMEVALUE Function
google sheets timevalue function1

This post will guide you how to use Google Sheets TIMEVALUE function with syntax and examples. Description The Google Sheets TIMEVALUE returns the decimal number of the time represented by a text string. It will convert a time represented by ...

Google Sheets TODAY Function
google sheets today function

This post will guide you how to use Google Sheets TODAY function with syntax and examples. Description The Google Sheets TODAY function get the current date as a date value. And it will be updated each time when your worksheet ...

Google Sheets TIME Function
google sheets time function1

This post will guide you how to use Google Sheets TIME function with syntax and examples. Description The Google Sheets TIME function converts an hour, minute and second into a time. The TIME function can be used to create a ...

Google Sheets SECOND Function
google sheets second function1

This post will guide you how to use Google Sheets SECOND function with syntax and examples. Description The Google Sheets SECOND function returns the seconds of a time value. Or returns an integer value that represent the second component of ...

Google Sheets NOW Function
google sheets now function1

This post will guide you how to use Google Sheets NOW function with syntax and examples. Description The Google Sheets NOW function returns the serial number of the current date and time. And it will be updated each time when ...

Google Sheets NETWORKDAYS.INTL Function
google sheets networkdays.intl function1

This post will guide you how to use Google Sheets NETWORKDAYS.INTL function with syntax and examples. Description The Google Sheets NETWORKDAYS.INTL function returns the number of net working days between tow given days excluding specified weekend days and holidays. The ...

Google Sheets NETWORKDAYS Function
google sheets networkdays function1

This post will guide you how to use Google Sheets NETWORKDAYS function with syntax and examples. Description The Google Sheets NETWORKDAYS function returns the number of net working days between tow given days. The NETWORKDAYS function can be used to ...

Google Sheets MONTH Function
google sheets month function1

This post will guide you how to use Google Sheets MONTH function with syntax and examples. Description The Google Sheets MONTH function returns the month of a date represented by a serial number. And the month is an integer number ...

Google Sheets MINUTE Function
google sheets minute function1

This post will guide you how to use Google Sheets MINUTE function with syntax and examples. Description The Google Sheets MINUTE returns the minutes of a time value. And the minutes is an integer number from 0 to 59. So ...

Sidebar