View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
janderson janderson is offline
external usenet poster
 
Posts: 4
Default Template for 40-year quarterly cash flow mixed with some monthly flows

OK, well I've done a little more thinking so I hope I can provoke a
response to some more specific ideas.

Outline process:

1. I have a primitive UDF that I call "DateGlobber" that generates a
series of regular-period dates based on a start date, number of
periods, and an interval in months. It just returns these dates as a
variant containing an array to a single cell. I can then use
SMALL(DateGlobber,row()) to return each date in rows on a worksheet.

For the moment I am content for it to rely on the EOMONTH add-in
function. I have not implemented the "convention" part of the function:
I intend that this will allow one to use built-in or add-in Excel
functions other than EOMONTH to do the actual work.

Option Base 1
Public Function DateGlobber(startdate As Date, periods As Long,
interval As Integer, _
Optional convention As Integer) As Variant

Dim count As Integer
Dim arr() As Date


ReDim Preserve arr(1 To periods)

For count = 1 To periods
arr(count) = eomonth(startdate, count * interval)
Next count

DateGlobber = arr

End Function

2. I intend to use or write another function to join the array of
regular period dates to a range-entered set of specific dates. Once I
have a single variant containing all of the dates, including
duplicates, from both sets of dates, I intend to use SMALL to provide a
list of unique dates down however many rows I need on my worksheet.

3. I can then base decisions on whether a value needs to be inflated,
say, by RPI, by testing whether the date is part of the regular-period
dates from my dateglobber function (with some extra to make it
only-every-fourth-period), or not.

Is this reasonable? Particularly re performance. For example, I am
wondering about calculation and recalculation overhead. Can I define a
name "regdates" as =DateGlobber(x,y,z), enter SMALL(regdates,row()) in
my rows and ensure thereby that no recalculation of these cells need
takeplace unless regdates is itself redefined?