+ Reply to Thread
Results 1 to 6 of 6

calculate number of months between 2 dates with conditions

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    2

    calculate number of months between 2 dates with conditions

    Hi
    How do I calculated number of months between 2 dates with the following conditions:
    A) if the date is before 15th for the month, full month is considered
    B) if the date is after 15th for the month, 0 month is considered

    Eg.
    2 September 2013 to 31 December 2013 = 4 months
    19 September 2013 to 31 December 2013 = 3 months

    I have used datedif function but it is not able to refined the results with the above conditions.
    Thanks

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

    Re: calculate number of months between 2 dates with conditions

    You didn't define what on 15th. of the month?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    (Format cell as mm)
    Last edited by zbor; 12-17-2013 at 03:41 AM.
    Never use Merged Cells in Excel

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: calculate number of months between 2 dates with conditions

    In A1 Cell
    02/09/2013

    In B1 Cell
    31/12/2013

    In C1 Cell
    =DATEDIF(A1,B1,"M")+IF(DAY(A1)<=15,1,0)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    12-17-2013
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: calculate number of months between 2 dates with conditions

    thanks a lot!

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: calculate number of months between 2 dates with conditions

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,706

    Re: calculate number of months between 2 dates with conditions

    You could also try this version

    =DATEDIF(A1-15,B1,"M")
    Audere est facere

+ 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] Calculate number of months between dates
    By steph44haf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-17-2013, 08:31 PM
  2. Calculate the number of Months between dates
    By Johndrew in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 02:18 AM
  3. [SOLVED] 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
  4. 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