Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
john liem
 
Posts: n/a
Default Calculate number of months between 2 dates


I have a Start Date and an End Date, need to calculate the number of
months in between. Conditions: Start date <=15th includes the month,
End date = 15th includes the month.
Examples: between 14-04-05 and 15-06-05: 3 months, between 16-04-05 and
13-06-05: 1 month, between 16-02-04 and 03-05-05: 14 months. Thank you.
John


--
john liem
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=12*(YEAR(B1)-YEAR(A1))+MONTH(B1)-MONTH(A1)+1-(DAY(A1)15)-(DAY(B1)<15)

In article ,
john liem wrote:

I have a Start Date and an End Date, need to calculate the number of
months in between. Conditions: Start date <=15th includes the month,
End date = 15th includes the month.
Examples: between 14-04-05 and 15-06-05: 3 months, between 16-04-05 and
13-06-05: 1 month, between 16-02-04 and 03-05-05: 14 months. Thank you.
John

  #3   Report Post  
Daniel CHEN
 
Posts: n/a
Default

Use the following formula:

=(YEAR(A2)-YEAR(A1))*12+MONTH(A2)-MONTH(A1)-1+IF(DAY(A1)<=15,1,0)+IF(DAY(A2)=15,1,0)

assume A1 is starting date and A2 is ending date.

===== * ===== * ===== * =====
Daniel CHEN

Spreadsheet/VBA Specialist

www.Geocities.com/UDQServices
Try UDQ Consulting Services - Your "Impossible" Task Could Be Someone Else's
"Piece of Cake"
===== * ===== * ===== * =====




"john liem" wrote in message
.. .

I have a Start Date and an End Date, need to calculate the number of
months in between. Conditions: Start date <=15th includes the month,
End date = 15th includes the month.
Examples: between 14-04-05 and 15-06-05: 3 months, between 16-04-05 and
13-06-05: 1 month, between 16-02-04 and 03-05-05: 14 months. Thank you.
John


--
john liem



  #4   Report Post  
Simon Cleal
 
Posts: n/a
Default

Alternativly use the DATEDIF function

=DATEDIF(A1,A2,"M")

The "M" indicates that you want the answer in Months...see Help for more info


Simon Cleal
************************************************** *****
"The computer allows you to make mistakes faster than any other invention,
with the possible exception of handguns and tequila" - Mitch Radcliffe
************************************************** *****

  #5   Report Post  
JE McGimpsey
 
Posts: n/a
Default

You probably should have tested this - DATEDIF() doesn't meet the
criteria in the problem statement.

For instance, in the example the OP gave:

A1: 14 Apr 2005
A2: 15 Jun 2005

DATEDIF returns 2, while by the OP's rules, the result should be 3.

In article ,
"Simon Cleal" wrote:

Alternativly use the DATEDIF function

=DATEDIF(A1,A2,"M")

The "M" indicates that you want the answer in Months...see Help for more info

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
Calculate Years/Months Between Dates and then Average Missy Excel Discussion (Misc queries) 3 February 12th 05 04:19 AM
I want to subtract 2 dates and display the result as months Dave Excel Worksheet Functions 3 January 30th 05 05:41 PM
calculate number of years D L Barnard New Users to Excel 1 January 26th 05 12:19 AM
Does Excel 2000 have a 'datedif' function to calculate the number. Kaddy Excel Worksheet Functions 7 December 11th 04 08:53 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 12:18 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"