<t>A few suggestions:- always use option explicit- I like using option base 1, gets you rid of the n-1 nonsenseTry the following:sub test() Dim cash_flow() as double, payout_dates() as date, n as long, discount as double, ans as doublen = range("cash_flow").countredim cash_flow(n) redim payout_dates...