I have a series of returns in a column of cells and would like to calculate the average slope calculated from the differences between each return value.
Returns:
0.05
0.06
0.04
0.07
0.05
0.06
I do not want to create a row for the differences because I have more columns of return streams beside the one above. I'm looking for a non-vba solution.
The answer I'm looking for is shown below:
Required Value: = Sum of slopes/No. of periods
Ans: -0.001666666
Cheers!
You can use a SUMPRODUCT() to get the sum of the differences then divide it by the count:
This one subtracts the lower from the upper:
=SUMPRODUCT($A$2:$A$6-$A$3:$A$7)/COUNT(A2:A7)
If you want it the other way around, by subtracting the upper from the lower then use this:
=SUMPRODUCT($A$3:$A$7-$A$2:$A$6)/COUNT(A2:A7)
At risk of being controversial:-
=(A7-A2)/COUNT(A3:A7)
because (A7-A6)+(A6-A5)...+(A3-A2) = A7-A2 and because there are only 5 differences between the 6 numbers, so my answer is 0.002..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.