7 Replies Latest reply on Jul 10, 2015 2:11 AM by kehumphr

    Need help creating a custom script for a simple calculation

    kehumphr Level 1

      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.