+ Reply to Thread
Results 1 to 16 of 16

Formula to calculate the number of months between two dates

  1. #1
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Formula to calculate the number of months between two dates

    Good morning,

    Ive done some searching but the formulas i have found are not working.

    What I need is a formula which will calculate the number of months between two dates, INCLUSIVE of the current month.

    For example:

    January 8, 2015 - January 28 2015 = 1 month.
    January 8, 2015 - May 20, 2015 = 5 months

    and so on.

    Thank you!!
    Last edited by mysticmoron109; 08-31-2015 at 09:35 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Formula to calculate the number of months between two dates

    How abouth:

    January 8, 2015 - May 2, 2015 ?
    Never use Merged Cells in Excel

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Formula to calculate the number of months between two dates

    January 8, 2015 - May 20, 2015 = 6 months
    how / why it is 6 Months
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Re: Formula to calculate the number of months between two dates

    please excuse me that was a typo. I meant 5 months.

    and it needs to return a whole number for the difference in months, inclusive of the current month.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Formula to calculate the number of months between two dates

    Onevway.. (of many...)

    =DATEDIF(EOMONTH(A1,-1)+1,EOMONTH(B1,0),"M")+1
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Registered User
    Join Date
    08-18-2015
    Location
    Bangladesh
    MS-Off Ver
    2010
    Posts
    20

    Re: Formula to calculate the number of months between two dates

    try:
    =Month(B1)-Month(A1)+1

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    Montreal, Qc, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Formula to calculate the number of months between two dates

    if they are all with in the same year then this will work...

    =(MONTH((F26))-MONTH((G26)))+1

    however, once your start changing years, you will need something a little more complex..


    =DATEDIF(C11,D11,"M")
    Last edited by Steve7913; 08-31-2015 at 09:50 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Formula to calculate the number of months between two dates

    Simple way:

    Please Login or Register  to view this content.
    Note : date at a1 < date at b1

    For information about datedif:
    http://www.exceltrick.com/formulas_m...edif-function/
    http://www.cpearson.com/excel/datedif.aspx
    Last edited by SDCh; 08-31-2015 at 09:49 AM. Reason: for info..:
    Click (*) if you received helpful response.

    Regards,
    David

  9. #9
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Re: Formula to calculate the number of months between two dates

    some data entries span 2 years.

    I am using Excel 2010 and DATEDIF returns a #NAME error.

  10. #10
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Re: Formula to calculate the number of months between two dates

    Quote Originally Posted by Steve7913 View Post
    if they are all with in the same year then this will work...

    =(MONTH((F26))-MONTH((G26)))+1

    however, once your start changing years, you will need something a little more complex..
    THis is what I am using now, but I take your point once we cover 2 years, which is what happens in my data. Who would have thought something so simple would be so complex to write a formula for? gah

  11. #11
    Registered User
    Join Date
    08-18-2015
    Location
    Bangladesh
    MS-Off Ver
    2010
    Posts
    20

    Re: Formula to calculate the number of months between two dates

    =(year(k81)-year(j81))*12+(month(k81)-month(j81))+1

  12. #12
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Formula to calculate the number of months between two dates

    Datedif return #NAME ?

    I always use this formula for span more than 5 years, and nothing happen like what you said

  13. #13
    Registered User
    Join Date
    08-01-2012
    Location
    Montreal, Qc, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Formula to calculate the number of months between two dates

    I modified my post to show the "DateDif" formula.. it should do the trick

  14. #14
    Registered User
    Join Date
    08-18-2015
    Location
    Bangladesh
    MS-Off Ver
    2010
    Posts
    20

    Re: Formula to calculate the number of months between two dates

    @SDCh:
    your suggested formula =DATEDIF(...) works as well

  15. #15
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Formula to calculate the number of months between two dates

    or
    =DATEDIF(,B1,"m")-DATEDIF(,A1,"m")+1
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    08-13-2009
    Location
    Caribbean
    MS-Off Ver
    Excel 2003
    Posts
    129

    Re: Formula to calculate the number of months between two dates

    Excellent. That was a bit tricky but ended up working out. I got two options form this post.

    Thanks a lot folks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Trying to calculate the number of months AND weeks between two dates..
    By DigitalWavez in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-01-2014, 04:43 PM
  2. Replies: 8
    Last Post: 02-20-2014, 05:46 PM
  3. [SOLVED] calculate number of months between 2 dates with conditions
    By beehong2628 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-17-2013, 07:12 AM
  4. Calculate number of months between dates
    By steph44haf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-17-2013, 08:31 PM
  5. Calculate the number of Months between dates
    By Johndrew in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 02:18 AM
  6. Calculate number of months between 2 dates
    By john liem in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-01-2005, 10:05 AM
  7. Calculate number of months between 2 dates
    By john liem in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 06-01-2005, 06:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1