Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Need help creating a custom script for a simple calculation

$
0
0

I am looking for a script that will allow me to take the average of several cells, but if the cell is blank, for it to be ignored.

 

For example, if I have five cells, and all five have numbers in them, I just need the total divided by 5.

 

But if I have five cells, and only four are filled in with numbers, then I want it to just be averaged by 4.

 

I think I explained it well enough, but let me know if you have other questions or need more info.

 

Cell 1Cell 2Cell 3Cell 4Cell 5Average
55347(5+5+3+4+7)/5=avg
5347(5+3+4+7)/4=avg

 

I don't want the blank cells to be calculated in (I don't want a zero averaged in), but I need a script that I can apply to several rows like the above.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>