Hello All,
I've written a function in VBA that did the tast i initially wanted (till i found out it was wrong)
My new piece of code doesn't do what i need it to and i don't know how to ammend it.
Currently my code does the following:
WAvgCost = WAvgCost + volume.Cells(numRows) * priceOnDay(numRows) / targetVolume
It then will repeat this and add and so forth. (see full code bellow)
The one ammendment i need is for it to divide the summed WavgCost by the first PriceOnDay and then minus that figure by 1.
So full code is:
What i need is a statement at the end that takes that takes WAvgCost and divides is by the first priceOnDay used and then minus 1 from that number then it needs to be placed in result(4) = difference.
Hope this makes sense.
I just don't know how to get it to use the first price on day. I think im just having a brain melt down.
Example Sum:
Target Volume: 10,000
Aggregate volume 1: 2097.2
Aggregate volume 2: 2650.4
Aggregate volume 3: 2318
Aggregate volume 4: 2979.4
Price Day 1: 13.09
Price Day 2: 12.7
Price day 3:12.41
Price day 4: 12.73
{[((2097.2*13.09)/10000)+((2605.4*12.7)/10000)+((2318*12.41)/10000)+((2979.4*12.73)/10000))] / 13.09} - 1 this should give you something like 0.028 or a change -2.8%
Please help me :D
Bookmarks