kingofaces
Board Regular
- Joined
- Aug 23, 2010
- Messages
- 68
I'm writing a function in VBA where I am entering a range for the variable and calculating from there. The mean of that range is calculated, but for each cell in the range I want to subtract the mean from it and square that value. The result of each cell will be summed.
For instance, if the range variable is set for G2:G10 then I would like to do: (G2-mean)^2 + (G3-mean)^2 +.......(G10-mean)^2 .
The main issue here is that I need to calculate a value for each cell in the range, and create a total from all those results. Any clarification on how to set this up would be appreciated. If anyone knows of a good guide the explains the range value a bit more would be nice too. Everything I find explains how to create a variable as a range, but I've had poor luck finding anything on how those variables specifically can be used. It seems to be the only basic thing I tend to trip over, so any help there is appreciated.
For instance, if the range variable is set for G2:G10 then I would like to do: (G2-mean)^2 + (G3-mean)^2 +.......(G10-mean)^2 .
The main issue here is that I need to calculate a value for each cell in the range, and create a total from all those results. Any clarification on how to set this up would be appreciated. If anyone knows of a good guide the explains the range value a bit more would be nice too. Everything I find explains how to create a variable as a range, but I've had poor luck finding anything on how those variables specifically can be used. It seems to be the only basic thing I tend to trip over, so any help there is appreciated.
Last edited: