calculer le nombre de mois entre 2 dates dans Excel office 365

Occasional Visitor

J'essaye de savoir combien de mois il y a entre 2 dates dans Excel pour office 365 et tout ce qu'on me propose c'est d'utiliser une vieille fonction qui n'apparait pas dans les fonctions de Excel: Dateif().

 

Cette fonction est mal documenté et ne fonctionne pas. Elle donne toujours l'erreur #nom?.

 

Comment faire pour simplement calculer le nombre de mois entre 2 dates... C'est quelque chose de standard non ? Ca devrait être simple non ?

 

Merci

 

5 Replies

@François_Soucy 

 

YOu're right that it's poorly documented. But it does work:

 

=DATEDIF(earlier_date,later_date,"m") 

 

It returns #NUM if the dates are reversed. So have the earlier of the two dates first in the function.

 

@François_Soucy The function is DATEDIF, and yes it has it's weaknesses. Documentation in the attached link. Alternatively, just deduct the start date from the end date and divide the result be 30.4167 (that is, the approximate average number of days per month in any given year).

 

https://support.microsoft.com/en-us/office/datedif-function-25dba1a4-2812-480b-84dd-8b32a451b35c 

@Riny_van_Eekelen  wrote just deduct the start date from the end date and divide the result be 30.4167 (that is, the approximate average number of days per month in any given year).

 

"approximate"!!??-- how many more decimal places would you need, my friend, before it's the precise average? [smiley face]

@mathetes Haha! As you know, one month may be 28, 29, 30 or 31 days, but never 30,4167. That's why I used the word "approximate". But it's good enough to the "how many months" calculation. 

@Riny_van_Eekelen   Well, to nit pick words (which happen to be one of several areas of life in which I pick nits), it was actually the phrase "approximate average" that caught my eye. So I was posing the question  of how many decimal places were required before we could describe it as a "precise average."   {broadly smiling face}