Recently, I got enquired about function for calculating number of days from one date to another date. DATEDIF is on the top of my mind. ：）
Interestingly this function is not commonly known probably because it won’t show up in the formula bar, even you type exact the DATEDIF in the formula bar… I still don’t know why actually.
Anyway, this simple function is quite useful.
Here’s the Syntax
where start_date and end_date are quite straight forward, right?
Still a reminder for you: “The end_date argument must be a date that occurs after start_date. The day of the ending date is not counted in the final result.” This is extracted from the HELP menu.
“Unit” may require a little description:
|“Y” – Number of FULL YEAR （from start date to end date)|
|“YM” – Number of FULL MONTH regardless of Year|
|“MD” – Number of DAY regardless of Year and Month|
|“YD” – Number of DAY regardless of Year|
|“M” – Number of FULL MONTH|
|“D” – Number of DAY|
Example gives better explanation:
#NUM! error because start_date occurs before end_date OR incorrect Unit used.
Let’s try it on your own!🙂