+1

Answered

# Sum of all cells in an array

Is there a way to get the sum of all of the values in an array?

Customer support service by UserEcho

+1

Answered

Is there a way to get the sum of all of the values in an array?

Customer support service by UserEcho

With out manually just adding logic to add each cell individually "array[0] + array[1]" etc

A workaround could be to take the average value of the array and multiply it with the array size.

Something like this in a math channel.

Result:=ArrayAverage(Array)*Array size

Unfortunately that does not work for me, as I am taking in hourly data in an array, and I then set up another array saying that if the data is greater than 0 then make this new 24 hour array have a 1 in that hour. I then add up those hours, and divide it by all of the data for a daily average. If i have an average data for either of the arrays it doesn't work as my machine may only run for 1 hour.

So to recap, I am basically trying to take hourly averages, display them in a 24 hour format, then get daily averages and display them in a 7 day format.

I don't see why it would not work.

The calculation "Result:=ArrayAverage(Array)*Array size" will not give you the average value of the array, it will give you the sum of all entries in the array.

The ArrayAverage function will give the average value of all cells in the array, even those that have not got any values assigned to them. if you then multiply that value with the array size you will get the total value of all cells in the array.

My apologies, and now that read it slower, it makes complete sense, and to be honest, I am a bit embarrassed I didn't think of it! The part I missed was the *array size

Can i mark this as answered?