SheetRocks
Documentation/Formulas/DATEDIF

DATEDIF

Calculates the number of days, months, or years between two dates

Syntax

DATEDIF(start_date, end_date, unit)

Arguments

Argument Description Required
start_date A date that represents the first, or starting date of the period Required
end_date A date that represents the last, or ending date of the period Required
unit The type of information you want returned: "Y", "M", "D", "MD", "YM", "YD" Required

Examples

Calculate years between two dates

=DATEDIF(A1, A2, "Y")
Result ⇒ 4
A
1 1/1/2020
2 1/1/2024

Calculate months between two dates

=DATEDIF(A1, A2, "M")
Result ⇒ 3
A
1 1/1/2024
2 4/1/2024

Calculate days between two dates

=DATEDIF(A1, A2, "D")
Result ⇒ 14
A
1 3/1/2024
2 3/15/2024

Related Functions

Other Date/Time functions:


← Back to Formula Reference