Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Calc Number of Months PER YEAR Between Dates

Hi:

I have two dates:

2/3/2005

6/8/2007

I need to calculate the number of months PER YEAR between the dates.
For example:

YEAR # MONTHS/YR
2005 12
2006 12
2007 6

This can be VBA, a recorded macro, or a calc. Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Calc Number of Months PER YEAR Between Dates

On Jul 11, 5:34*pm, amywolfie wrote:
Hi:

I have two dates:

2/3/2005

6/8/2007

I need to calculate the number of months PER YEAR between the dates.
For example:

YEAR * *# MONTHS/YR
2005 * * 12
2006 * * 12
2007 * * *6

This can be VBA, a recorded macro, or a calc. *Thanks!


This UDF (placed in a REGULAR module) and then, on the sheet, type
=monthsinyear(a1,a2,2005)
or if b1 has 2005
=monthsinyear(a1,a2,b1)
to get 2005
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Calc Number of Months PER YEAR Between Dates

Thanks Don.

I have never written VBA code for Excel, only Access.

How do you define a REGULAR module?

Do you create a Public Function monthsinyear () where

Dim monthsinyear As Integer

Is there anything else that has to be coded in VBA?

Thanks!
====
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
Number of Months Between Two Dates Entered Rob Excel Discussion (Misc queries) 13 April 21st 09 12:21 AM
Calc days between two dates and exclude leap year days scoz Excel Worksheet Functions 5 November 23rd 07 03:58 PM
Dates: How to check if date value is 10 months and or 1 year old? Rick S. Excel Programming 8 October 2nd 07 03:30 PM
Number of months between 2 dates john liem New Users to Excel 0 May 31st 05 06:08 PM
count number of months year to date coal_miner Excel Worksheet Functions 1 May 4th 05 02:41 PM


All times are GMT +1. The time now is 01:41 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"