start_date | The date from which the calculation begins |
end_date | The date at which the calculation ends |
unit | The format (day, month, year) in which the difference should be calculated. |
Unit | Description |
Y | Calculates the difference in years |
M | Calculates the difference in months |
D | Calculates the difference in days |
MD | Calculates the difference in days, excluding months and years |
YM | Calculates the difference in months, excluding years |
YD | Calculates the difference in days excluding years |
Example | Syntax | Output |
Calculate the difference between June 12, 2024 and August 28, 2024 in days | =DATEDIF([12/06/2024], [28/08/2024],"D") | 77 |
Calculate the difference between Aug. 28, 2024 and Oct. 30, 2024 in days, excluding months and years | =DATEDIF([28/08/2024], [30/10/2024],"MD") | 2 (Because the difference is 2 days and 2 months, this formula returns 1 day) |
Calculate the difference between Feb. 20, 2024 and April 20, 2025 in months excluding years | =DATEDIF([20/02/2024], [20/04/2025],"YM") | 2 (Because the difference is 1 year and 2 months, this formula returns 2 months) |