+ Reply to Thread
Results 1 to 5 of 5

Calculating Dates in Terms of Months

  1. #1
    Jessica
    Guest

    Calculating Dates in Terms of Months

    I am trying to find a function that will allow me to calculate the difference
    between two dates. I want the answer to be shown in months only, therefore I
    would need any additional days to be converted to a decimal. I tried to the
    datedif function, but it does not recognize that the time span between months
    may cross over multiple years.

    For example I have the following:
    Start Date: 04/15/02
    End Date: 06/28/03

    The number of whole months in between is 14, however their are also
    additional days in between and I am looking to convert those to a decimal.
    I know the difference in months

  2. #2
    bj
    Guest

    RE: Calculating Dates in Terms of Months

    datedif does do total months
    if you can stand using 30 days for each month for your decimal try

    =datedif(date1,date2,"m") +datedif(date1,date2,"md")/30

    if you want to be more complex than the 30 days per month approximation, the
    equation gets more complicated.

    "Jessica" wrote:

    > I am trying to find a function that will allow me to calculate the difference
    > between two dates. I want the answer to be shown in months only, therefore I
    > would need any additional days to be converted to a decimal. I tried to the
    > datedif function, but it does not recognize that the time span between months
    > may cross over multiple years.
    >
    > For example I have the following:
    > Start Date: 04/15/02
    > End Date: 06/28/03
    >
    > The number of whole months in between is 14, however their are also
    > additional days in between and I am looking to convert those to a decimal.
    > I know the difference in months


  3. #3
    Roger Govier
    Guest

    Re: Calculating Dates in Terms of Months

    Hi Jessica

    One way, with start date in A1 and end date in A2
    =DATEDIF(A1,A2,"m")&MID(DATEDIF(A1,A2,"md")/DAY(EOMONTH(A2,0)),2,4)

    You need to load the addin Analysis ToolPak for this to work
    Tools>Addins and check Analysis Toolpak

    Regards

    Roger Govier


    Jessica wrote:
    > I am trying to find a function that will allow me to calculate the difference
    > between two dates. I want the answer to be shown in months only, therefore I
    > would need any additional days to be converted to a decimal. I tried to the
    > datedif function, but it does not recognize that the time span between months
    > may cross over multiple years.
    >
    > For example I have the following:
    > Start Date: 04/15/02
    > End Date: 06/28/03
    >
    > The number of whole months in between is 14, however their are also
    > additional days in between and I am looking to convert those to a decimal.
    > I know the difference in months


  4. #4
    Roger Govier
    Guest

    Re: Calculating Dates in Terms of Months

    Hi Jessica

    I forgot to say you need to format the cell with the formula as General.
    Also, if you want it as a number and not text, then wrap the equation in
    brackets and add 0

    =(DATEDIF(A1,A2,"m")&MID(DATEDIF(A1,A2,"md")/DAY(EOMONTH(A2,0)),2,4))+0


    Regards

    Roger Govier


    Roger Govier wrote:
    > Hi Jessica
    >
    > One way, with start date in A1 and end date in A2
    > =DATEDIF(A1,A2,"m")&MID(DATEDIF(A1,A2,"md")/DAY(EOMONTH(A2,0)),2,4)
    >
    > You need to load the addin Analysis ToolPak for this to work
    > Tools>Addins and check Analysis Toolpak
    >
    > Regards
    >
    > Roger Govier
    >
    >
    > Jessica wrote:
    >
    >> I am trying to find a function that will allow me to calculate the
    >> difference between two dates. I want the answer to be shown in months
    >> only, therefore I would need any additional days to be converted to a
    >> decimal. I tried to the datedif function, but it does not recognize
    >> that the time span between months may cross over multiple years.
    >>
    >> For example I have the following:
    >> Start Date: 04/15/02
    >> End Date: 06/28/03
    >>
    >> The number of whole months in between is 14, however their are also
    >> additional days in between and I am looking to convert those to a
    >> decimal.
    >> I know the difference in months


  5. #5
    Ron Rosenfeld
    Guest

    Re: Calculating Dates in Terms of Months

    On Tue, 20 Sep 2005 08:07:06 -0700, "Jessica"
    <[email protected]> wrote:

    >I am trying to find a function that will allow me to calculate the difference
    >between two dates. I want the answer to be shown in months only, therefore I
    >would need any additional days to be converted to a decimal. I tried to the
    >datedif function, but it does not recognize that the time span between months
    >may cross over multiple years.
    >
    >For example I have the following:
    >Start Date: 04/15/02
    >End Date: 06/28/03
    >
    >The number of whole months in between is 14, however their are also
    >additional days in between and I am looking to convert those to a decimal.
    >I know the difference in months


    What do you mean by a "whole month".

    If you mean Calendar month, then there are only 13 "whole months" + 2
    fractional months -- in this case 15/30 + 28/30. (I think this is the least
    ambiguous method).

    If you mean the corresponding day in the End Date month, then you have to
    decide how to deal with the issue of what happens if there is no corresponding
    day in the End Date month, and also what your denominator will be for the
    fractional month (the start month, the end month, 30, 30.416667, etc)

    If you use the DATEDIF function, as suggested by another poster, you wind up
    with the following:

    StartDate EndDate DateDif CalendarMonths
    28-Jan-2005 28-Feb-2005 1.00 1.10
    29-Jan-2005 28-Feb-2005 1.00 1.06
    30-Jan-2005 28-Feb-2005 0.97 1.03
    31-Jan-2005 28-Feb-2005 0.93 1.00

    There is no "right or wrong"; it's a matter of understanding the results you
    obtain. But note that with DateDif, it is possible to obtain the same result
    with two different StartDate's.

    You also need to decide whether or not you wish to count both the StartDate and
    EndDate, or merely subtract the one from the other.


    --ron

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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