View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] stephen.h.dow@gmail.com is offline
external usenet poster
 
Posts: 6
Default Array Math in UDF

I seem to have answered my own problem, so thought I'd post the
solution:

Function Recovery(RecovArray, LossArray, PeriodArray, Period As
Single) As Double
Dim Element As Variant
Dim SumRecov As Double
Dim Iteration As Integer
Dim LossOffset As Integer
Dim CalcPeriod As Integer

Iteration = 0
LossOffset = Period - 1

Do
SumRecov = SumRecov + RecovArray(Period - Iteration) *
LossArray(Period - LossOffset)
Iteration = Iteration + 1
LossOffset = LossOffset - 1
CalcPeriod = CalcPeriod + 1
Loop Until CalcPeriod = Period

Recovery = SumRecov

End Function