I want to sum values in a multidimensional array as such. {1,2,3;2,3,4;3,4,5;4,5,6} and this would return {6;9;12;15}.
Any ideas?
I want to sum values in a multidimensional array as such. {1,2,3;2,3,4;3,4,5;4,5,6} and this would return {6;9;12;15}.
Any ideas?
Re: Summing multidimensional arrays
Hi
how are you generating the array?
Re: Summing multidimensional arrays
Perhaps:-
Results column "A"
Dim ray, R As Long, Ac As Long, c As Long
ray = [{1,2,3;2,3,4;3,4,5;4,5,6}] ' and this would return {6;9;12;15}.
ReDim nRay(1 To UBound(ray, 1))
For R = 1 To UBound(ray, 1)
c = c + 1
For Ac = 1 To UBound(ray, 2)
nRay(c) = nRay(c) + ray(R, Ac)
Next Ac
Next R
Range("A1").Resize(UBound(ray, 1)).Value = Application.Transpose(nRay)
Re: Summing multidimensional arrays
Hi.
MMULT({1,2,3;2,3,4;3,4,5;4,5,6},{1;1;1})
will generate:
{6;9;12;15}
Regards
Advanced Excel Techniques: http://excelxor.com/
Re: Summing multidimensional arrays
Awesome XOR LX!!
Re: Summing multidimensional arrays
Quote from GreasySpot;764102Awesome XOR LX!!
Just elementary mathematics, really!
But cheers anyway!
Re: Summing multidimensional arrays
As usual XOR LX is coming up with a Killer solution ...from the World of ... Matrix ...!!!
Absolutely Great ... !!! :smile:
Re: Summing multidimensional arrays
Quote from Carim;764113As usual XOR LX is coming up with a Killer solution ...from the World of ... Matrix ...!!!
Absolutely Great ... !!! :smile:
"World of Matrix"! Love it!! :smile::smile:
Don’t have an account yet? Register yourself now and be a part of our community!