#1   Report Post  
Aaron Howe
 
Posts: n/a
Default Counting months

I have been trying without success to use the MONTH function to calculate a
period of months between two dates. My aim is to take, say, cell A1 which
has 11/07/05 and deduct it from cell B1 which has 10/07/06 and for the result
to be 12 which it should be.

For the most part, MONTH(B1)-MONTH(A1) works fine. However, it doesn't work
when the total number of months exceed 12... I don't want to jam up my sheet
with formulae (the cell will be replicated 200 times), with IF statements and
concatenates...

Is there a simple and effective use for getting the month value in a period
of more than 12 months?
  #2   Report Post  
VoG via OfficeKB.com
 
Posts: n/a
Default

Have you tried using DATEDIF

=DATEDIF(A1,B1,"m")


--
Message posted via http://www.officekb.com
  #3   Report Post  
Aaron Howe
 
Posts: n/a
Default

Additionally, I found this formula on the KB:

=IF(ISNUMBER(V2),(YEAR(V2)-YEAR(U2))*12+MONTH(V2)-MONTH(U2),0)

But this does not work where the beginning month (U2) is the first of the
month (i.e. 01/07/05) and the end month the end of a month (30/06/06) -
technically 12 months but shown as 11.

"Aaron Howe" wrote:

I have been trying without success to use the MONTH function to calculate a
period of months between two dates. My aim is to take, say, cell A1 which
has 11/07/05 and deduct it from cell B1 which has 10/07/06 and for the result
to be 12 which it should be.

For the most part, MONTH(B1)-MONTH(A1) works fine. However, it doesn't work
when the total number of months exceed 12... I don't want to jam up my sheet
with formulae (the cell will be replicated 200 times), with IF statements and
concatenates...

Is there a simple and effective use for getting the month value in a period
of more than 12 months?

  #4   Report Post  
Aaron Howe
 
Posts: n/a
Default

That does achieve my aim, but leaves me with the 11-month issue where the
"start" date is the first of a month...

"VoG via OfficeKB.com" wrote:

Have you tried using DATEDIF

=DATEDIF(A1,B1,"m")


--
Message posted via http://www.officekb.com

  #5   Report Post  
Niek Otten
 
Posts: n/a
Default


That is a somewhat particular definition of a month (certainly not
technically 12 months). But if it really is what you require, just add 1 to
the end date in the DATEDIF function.

--
Kind regards,

Niek Otten

Microsoft MVP - Excel

"Aaron Howe" wrote in message
...
Additionally, I found this formula on the KB:

=IF(ISNUMBER(V2),(YEAR(V2)-YEAR(U2))*12+MONTH(V2)-MONTH(U2),0)

But this does not work where the beginning month (U2) is the first of the
month (i.e. 01/07/05) and the end month the end of a month (30/06/06) -
technically 12 months but shown as 11.

"Aaron Howe" wrote:

I have been trying without success to use the MONTH function to calculate
a
period of months between two dates. My aim is to take, say, cell A1
which
has 11/07/05 and deduct it from cell B1 which has 10/07/06 and for the
result
to be 12 which it should be.

For the most part, MONTH(B1)-MONTH(A1) works fine. However, it doesn't
work
when the total number of months exceed 12... I don't want to jam up my
sheet
with formulae (the cell will be replicated 200 times), with IF statements
and
concatenates...

Is there a simple and effective use for getting the month value in a
period
of more than 12 months?





  #6   Report Post  
Aaron Howe
 
Posts: n/a
Default

I don't think this group is the right place to start bickering about what
constitutes 12 months (to midnight, yes it does thanks). Adding 1 would
therefore throw out the rest of the calculations...

Anyone else managed a workaround for this?

"Niek Otten" wrote:


That is a somewhat particular definition of a month (certainly not
technically 12 months). But if it really is what you require, just add 1 to
the end date in the DATEDIF function.

--
Kind regards,

Niek Otten

Microsoft MVP - Excel

"Aaron Howe" wrote in message
...
Additionally, I found this formula on the KB:

=IF(ISNUMBER(V2),(YEAR(V2)-YEAR(U2))*12+MONTH(V2)-MONTH(U2),0)

But this does not work where the beginning month (U2) is the first of the
month (i.e. 01/07/05) and the end month the end of a month (30/06/06) -
technically 12 months but shown as 11.

"Aaron Howe" wrote:

I have been trying without success to use the MONTH function to calculate
a
period of months between two dates. My aim is to take, say, cell A1
which
has 11/07/05 and deduct it from cell B1 which has 10/07/06 and for the
result
to be 12 which it should be.

For the most part, MONTH(B1)-MONTH(A1) works fine. However, it doesn't
work
when the total number of months exceed 12... I don't want to jam up my
sheet
with formulae (the cell will be replicated 200 times), with IF statements
and
concatenates...

Is there a simple and effective use for getting the month value in a
period
of more than 12 months?




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
Why "datedif" function results sometimes negative numbers? Ambrosiy Excel Worksheet Functions 1 July 8th 05 11:29 AM
Calculate number of months between 2 dates john liem New Users to Excel 4 June 1st 05 02:08 PM
How do i change 15 months to read 1 year and 3 months? Marty Excel Discussion (Misc queries) 1 February 17th 05 11:21 PM
How do I calculate total of months that have passed? jaydubs Excel Discussion (Misc queries) 1 February 8th 05 11:27 AM
Converting months to years kevin Excel Worksheet Functions 1 January 20th 05 01:28 PM


All times are GMT +1. The time now is 06:05 PM.

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"