1. Home
  2. Functions
  3. Date and time
  4. DATEDIF

DATEDIF function

Counts the whole days, months or years between two dates.

Syntax

=DATEDIF(start_date, end_date, unit)

Arguments

ArgumentRequiredDescription
start_dateRequiredThe earlier date
end_dateRequiredThe later date
unitRequired"Y", "M", "D", "MD", "YM" or "YD"

How to use DATEDIF

DATEDIF takes 3 required arguments. Type =DATEDIF( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=DATEDIF(DATE(2001,1,1), DATE(2003,1,1), "Y")Result 2
=DATEDIF(DATE(2001,6,1), DATE(2002,8,15), "D")Result 440
=DATEDIF(DATE(2001,6,1), DATE(2002,8,15), "YD")Result 75

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.