View Single Post
  #1   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

Here's a tricky one that I just can't seem to wrap my head around...

I'm looking at recovery rates (could be for chemical reactions,
finanical transaction, etc) over time. In each period I "lose" a
certain quantity, but know that I will recover a predetermined portion
(say 45%) over a predetermined recovery curve (4.5% in current period,
9%, 18%, 4.5%, and 9% in period +4). I'm trying to create a UDF that
will calculate the total recovered for a given period. The recovery
for a given period will include the 4.5% of the "loss" in the current
period plus and recovered amounts from prior period, if applicable.

A simplified example is:
Period | Loss | Recovered Amount
1 | 100 | 4.5
2 | 200 | 18 (9%*100 + 4.5%*200)
3 | 100 | 40.5
4 | 0 | 49.5
5 | 0 | 36
6 | 0 | 22.5
7 | 0 | 9

So, the total recovered amount is 180, which is 45% of the 400 that
was lost.

If anyone help me get started or point me to something that solved for
a similar problem, I would greatly appreciate it.

Thanks,
Steve