ReferenceFunctionsDate & Time Functions
DATEDIF
DATEDIF: Returns the difference between two dates in a requested unit.
Summary
Returns the difference between two dates in a requested unit.
Remarks
- Supported units are
"Y","M","D","MD","YM", and"YD". - If
start_date > end_date, the function returns#NUM!. - Unit matching is case-insensitive.
"YD"uses a Feb-29 normalization strategy that can differ slightly from Excel in edge cases.- Input serials are interpreted with Excel 1900 date mapping.
Examples
Difference in days
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
181
Complete months difference
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
6
Related functions
FAQ
How are unit strings interpreted in DATEDIF?
Unit text is case-insensitive, but only Y, M, D, MD, YM, and YD are supported; other units return #NUM!.
Runtime metadata
Category
Date & Time
Signature
DATEDIF(arg1: Number, arg2: Number, arg3: Any)Arity
min 3, max 3
Arguments
arg1Number · Scalar · coercion NumberLenientText
arg2Number · Scalar · coercion NumberLenientText
arg3Any · Scalar
Caps
PURE
Source