Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 313
Default Month Calculation

I would like to calcuate the diff in the dates by in term of months e.g.
30.06.05 less 19.11.04 = 8 months. What function should I use, could any one
help please. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 146
Default Month Calculation

There is an undocumented function in Excel called DATEDIF. Microsoft has
never documented it. It comes from Lotus 1-2-3.
It does not appear in the list of functions. You must manually type it in.
Its format is =DATEDIF(start_date,end_date,"F"). Note that start_date must
be less or equal to end_date or you will get a #NUM error.
F must be in quotes and may be the following:

"y" The number of complete years in the period
"m" The number of complete months in the period
"d" The number of days in the period.
"md" The difference between the days in start_date and
end_date. The months and years of the dates are ignored.
"ym" The difference between the months in start_date and
end_date. The days and years of the dates are ignored.
"yd" The difference between the days in start_date and
end_date. The years of the dates are ignored.

So if cell A1 has 30.06.05 and cell A2 has 19.11.04 then
=DATEDIF(A2,A1,"m") would return 7, the number of whole months difference
between those dates.


"Tony" wrote in message
...
I would like to calcuate the diff in the dates by in term of months e.g.
30.06.05 less 19.11.04 = 8 months. What function should I use, could any
one
help please. Thanks



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Month Calculation

"Dave Thomas" wrote...
There is an undocumented function in Excel called DATEDIF. Microsoft has
never documented it. . . .


Bizarrely enough, Microsoft DID document it in Excel 2000, but neither in
previous nor subsequent versions.

. . . It comes from Lotus 1-2-3. . . .


Which could be said of 90% or more of Excel's functions.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Month Calculation

On Jul 15, 8:10 pm, Tony wrote:
I would like to calcuate the diff in the dates by in term of months
e.g. 30.06.05 less 19.11.04 = 8 months. What function should I
use, could any one help please.


As Dave pointed out, DATEDIF() alone does not give you the result you
want -- unless you misstated your requirement. The following might do
the trick for you:

=datedif(A1, A2, "m") +
or(day(A1)<day(A2), and(day(A1)day(A2), A1=eomonth(A1,0),
A2=eomonth(A2,0)))

where A1 is the earlier date (e.g. 19.11.04) and A2 is the later date
(e.g. 30.06.05). The logic is: the difference in months, plus one
only if:

1. The earlier day is less than the later day (that is, more than an
exact number of months elapsed), as in your example. Or

2. The earlier day is greater than the later day, but both dates are
the end of the month. For example, the difference between 31.12.2004
and 28.2.2005 would be 2 months.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 524
Default Month Calculation

Mon, 16 Jul 2007 04:06:57 GMT from Dave Thomas :
There is an undocumented function in Excel called DATEDIF.


And Chip Pearson documents it at
http://cpearson.com/excel/datedif.htm

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
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
Help!!! End of Month Calculation Tony Excel Worksheet Functions 4 February 16th 07 09:07 AM
Last Day Of Month Calculation... Jay Excel Worksheet Functions 3 July 11th 06 03:17 PM
Month end calculation Tony Excel Worksheet Functions 12 March 24th 06 12:56 AM
Month end calculation Tony Excel Discussion (Misc queries) 2 March 23rd 06 01:24 AM
month-to-month calculation Colin2u Excel Discussion (Misc queries) 0 July 27th 05 01:32 AM


All times are GMT +1. The time now is 10:41 AM.

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

About Us

"It's about Microsoft Excel"