Formualizer Docs
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
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
181
Complete months difference
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
6

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

arg1

Number · Scalar · coercion NumberLenientText

arg2

Number · Scalar · coercion NumberLenientText

arg3

Any · Scalar

Caps

PURE

Source

On this page