PC Review


Reply
Thread Tools Rate Thread

Calc Number of Months PER YEAR Between Dates

 
 
amywolfie
Guest
Posts: n/a
 
      11th Jul 2011
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!

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      12th Jul 2011
On Jul 11, 5:34*pm, amywolfie <amywol...@gmail.com> 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
 
Reply With Quote
 
amywolfie
Guest
Posts: n/a
 
      12th Jul 2011
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dates: How to check if date value is 10 months and or 1 year old? =?Utf-8?B?UmljayBTLg==?= Microsoft Excel Programming 8 2nd Oct 2007 03:30 PM
count number of months year to date =?Utf-8?B?Y29hbF9taW5lcg==?= Microsoft Excel Worksheet Functions 1 4th May 2005 02:41 PM
how to get dates for a months and year =?Utf-8?B?QWxleA==?= Microsoft Access Queries 3 6th Nov 2004 08:17 PM
Sort Dates by Months irrespective of Year xpnovice Microsoft Access 4 16th Sep 2004 12:40 PM
NUMBER OF MONTHS in EXCEL CALC ROYB Microsoft Excel Worksheet Functions 1 18th Sep 2003 05:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 PM.