View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
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