Title: Average input calculation
Last modified: July 13, 2019

---

# Average input calculation

 *  Resolved [120filter](https://wordpress.org/support/users/120filter/)
 * (@120filter)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/average-input-calculation/)
 * I don’t know if this is possible and my maths skills are letting me down because
   they don’t exist.
 * What I’m failing to acheive is:
 * 1. User inputs a series of digits between 0 & 10 [eg 2, 7, 4, 9, 8,]
    This will
   be a variable list. Above, the user has inputted 5 digits. It could be 50 digits].
   2. A simple calculation adding the list would take place [above = 30]. 3. Another
   calculation would divide this total by the number of digits inputted [in this
   example it would be 30 divided by 5 = 6]
 * The end result would be an average figure based on the list of numbers inputted.
 * The big problem is how to input the variable list of numbers (1)
    (2) is a simple
   addition (3) is a simple division but I need to count the of digits inputted:
   a text count is all i can think of unless the user inputs the numbers seperated
   by spaces

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

 *  Thread Starter [120filter](https://wordpress.org/support/users/120filter/)
 * (@120filter)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/average-input-calculation/#post-11728271)
 * Thankyou that worked perfect.
    I can’t seem to get the hang of the using the 
   function language like you do. It’s only my second form though. Thanks
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/average-input-calculation/#post-11728285)
 * Hello [@120filter](https://wordpress.org/support/users/120filter/)
 * It has been a pleasure.
 * In the majority of cases, there is not required to implement complex equations,
   but the yours it is peculiar.
 * Best regards.
 *  Thread Starter [120filter](https://wordpress.org/support/users/120filter/)
 * (@120filter)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/average-input-calculation/#post-11731789)
 * Me again,
 * It works perfect
 * However, it treats 10 as 1
 * eg 1 2 3 = 6 correct
    eg 1 2 10 = 3 wrong [should be 13]
 * I tried adding variations of this
    /^(\d{1,2}|10])$/
 * which says numbers comprise one or two digits with max of 10 [ie can’t enter 
   11]
 * But, I think this should go in the text area [which I can’t do] as opposed to
   the calculation box?

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

The topic ‘Average input calculation’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [120filter](https://wordpress.org/support/users/120filter/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/average-input-calculation/#post-11731789)
 * Status: resolved