Growing sum of changing values

dpa

New Member
Joined
Oct 22, 2011
Messages
14
Hi,
I have data from B1 to B80. To process this data, I have several parameters called Fixtime, Changetime

Fixtime is chosen by the user (lets assume a value of 2)
Changetime starts in 0.5

The general formula i need to use would be (which increases as cell increases): Results = Value_of_B*Changetime*Fixtime

As an example, in excel I can simply create a cell formula to obtain the results I need:

D1 = B1*0.5*2
D2 = B1*1.5*2 + B2*0.5*2
D3 = B1*2.5*2 + B2*1.5*2 + B3*0.5*2
D4 = B1*3.5*2 + B2*2.5*2 + B3*1.5*2 + B4*1.5*2
D5 = B1*4.5*2 + B2*3.5*2 + B3*2.5*2 + B4*1.5*2 + B5*0.5*2
.
.
D80 = .....

Note how the values of 0.5 (Changetime) are varying as the next D cell is required, each time one additional value is summed and at the same time "changetime" values increase.

As you can imagine, to do this up to D80 is annoying and takes time, once is there, is easier, but is not efficient.

I was wondering if any of the vba experts would have a cheap, simple and fast solution of a code to fill D1 to D80 and by doing the same exact calculations as in the example I presented, my problem is basically on how to loop (though I heard looping was not recommended as it is slow) to achieve the desired calculation.:confused:

Hope you can help.

Thanks in advance.
 
Probably depends on what you give to "val"

It should be arrays from 1 up to 1-80

I guess formula would be:
=SUMPRODUCT($B$1:B1*(2*1/2*EXP(-(((ROW()-ROW($B$1:B1)+0.5)*2/2)+2-1))))

Yes, the formula works good. Thank you again for your help.

If you happen to have a suggestion for a VBA code that can do the same thing for the three cases we discussed, It would be great, I am still looking for one vba routine to run the same procedures done in cells D1 to D80. Have a nice day.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,215,988
Messages
6,128,144
Members
449,426
Latest member
revK

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top