Title: Average
Last modified: June 20, 2022

---

# Average

 *  Resolved [mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * (@mahakaal28)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/)
 * Hello,
    I am trying to achieve the below form. Could it be possible to do in 
   cff.
 * Fieldname1 = single line text. User should be able to enter series of numbers(
   for eg: 1, 2, 3, 7, 9)
 * Fieldname2 = calculated field. It will count the numbers entered in fieldname1.
 * Fieldname3 = calculated field. It will add the numbers in fieldname1.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15752473)
 * Hello [@mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * Yes, that’s possible. Please, enter the following equation in the fieldname3 
   field:
 *     ```
       (function(){
       var v = fieldname1|r;
       v = (new String(v)).replace(/[^\d\.\,]/g, '').replace(/\,+/g, ',');
       return AVERAGE(v.split(','));
       })()
       ```
   
 * Best regards.
 *  Thread Starter [mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * (@mahakaal28)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15752900)
 * I also want to show the numbers count in fieldname2.
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15754696)
 * Hello [@mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * In this case, the equation can be edited as follows:
 *     ```
       (function(){
       var v = fieldname1|r;
       v = (new String(v)).replace(/[^\d\.\,]/g, '').replace(/\,+/g, ',');
       var n = v.split(',');
       return 'Average: '+AVERAGE(v.split(','))+' count: '+n.length;
       })()
       ```
   
 * Best regards.
 *  Thread Starter [mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * (@mahakaal28)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15770207)
 * Will it be possible, from enter values in fieldname1.
 * {(1²+ 2²+ 3²+ 7²+ 9²) – ((1+2+3+7+9)²/count)} / (count-1)
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15770470)
 * Hello [@mahakaal28](https://wordpress.org/support/users/mahakaal28/)
 * In the new case, the equation would be similar to:
 *     ```
       (function(){
       var v = fieldname1|r;
       v = (new String(v)).replace(/[^\d\.\,]/g, '').replace(/\,+/g, ',');
       var n = v.split(','), 
           count = n.length,
           a = 0,
           b = 0;
       for(var i in n)
       {
       a += POW(n[i], 2);
       b += n[i]*1
       }
       return (a - (POW(b, 2)/count)) / (count-1);
       })()
       ```
   
 * Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Average’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/average-16/#post-15770470)
 * Status: resolved