Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jessica
 
Posts: n/a
Default 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   Report Post  
bj
 
Posts: n/a
Default

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   Report Post  
Roger Govier
 
Posts: n/a
Default

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
ToolsAddins 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   Report Post  
Roger Govier
 
Posts: n/a
Default

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
ToolsAddins 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   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Tue, 20 Sep 2005 08:07:06 -0700, "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


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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
months between 2 dates!!! speary Excel Discussion (Misc queries) 1 August 19th 05 03:22 PM
How do I take a column of dates and add six months? tigerswilson Excel Worksheet Functions 2 July 26th 05 06:28 AM
Calculate number of months between 2 dates john liem New Users to Excel 4 June 1st 05 02:08 PM
Need More Help on Dates to Months Xandlyn Excel Worksheet Functions 4 March 12th 05 12:50 PM
How do I display months and years between two dates JSmith Excel Discussion (Misc queries) 1 November 30th 04 04:41 PM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"