I have 4 columns labelled 1st Year, Frequency, Spread and cost.
then I have columns spanning upto 30. I need a formula/function/macro that depending on what I type in the first 4 columns it will populate the remaining 30 columns with either cost or 0.

example: if I had £9,000 at a frequency of 10, starting on the 5th year with a spread of 3.
The cost represents the cost of each frequent. so in the example I would get £3,000 on years 5,6,7,15,16,17,25,26,27

I currently have =IF($K:$K>0,IF(OR($8:$8=$J:$J,MOD($8:$8-$J:$J,$K:$K)=0),$L:$L,0),0)

where K is frequency, 8:8 is year, J is cost

its the spread that I cant figure out!

Thank you in advance I hope this has made sense!!

James