# counting months

##### New Member
I need to count the number of months that have passed since a certain date. Is there a way to achieve this in a formula? Ex. From 1/1/01 to 6/1/02 17 months have passed.

### Excel Facts

If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
On 2002-09-12 12:44, lenze wrote:
=DATEDIF(A1,A2,"m")

See Chip Pearson's page on working with dates.

http://www.cpearson.com/excel/datedif.htm
This message was edited by lenze on 2002-09-12 12:44

Oh?
What about (for example) 31 Dec 2001 and 30 Sep 2002 ?
Should it not be 9?

The Excel version of DATEDIF returns the number of whole months. That's why you get an 8. That's also why the DATE.DIFF may be more flexible.

the following formula:

=IF(MONTH(A1)>=MONTH(A2),MONTH(A2-A1),((YEAR(A2)-YEAR(A1))*12)+MONTH(A2-A1))

will also return the value you want, as well as the value for, say, 12/31/01 and 9/30/02.

or for 1/1/01 to 12/31/01, it will return the value of 12 months instead of 11, as the datedif formula does. depends on what you want i guess.

HTH
kevin

On 2002-09-12 13:08, lenze wrote:
The Excel version of DATEDIF returns the number of whole months. That's why you get an 8. That's also why the DATE.DIFF may be more flexible.

I think they behave similarly...

=DATE.DIFF(A1,B1,3)

which gives a result like

0 an 8 mois 30 jours (yes, it's French!)

is much shorter than an equivalent DATEDIF formula.

Replies
5
Views
152
Replies
3
Views
175
Replies
8
Views
142
Replies
4
Views
394
Replies
1
Views
55

1,217,756
Messages
6,138,425
Members
450,136
Latest member
Tabako1960

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back