Using Advanced Expression Piping within your forms you can create mathematical formulas in order to calculate a value. A common formula used is to determine the Average value from multiple fields. This article will demonstrate how to configure an AVG expression using AEP within a form.

**In this Article...**

The AVG function allows the expression to calculate the average value within a given list. While not as commonly used as the SUM function, this functions provides a quick way of getting the average from a list of different variables within a form or from a column within a table.

The setup and formatting of the AVG expression is imperative in preventing an ** error** message from appearing on your form where the result of your expression would normally appear. The first line of the AVG expression should be set up as follows:

{{ AVG(variable1,variable2) }} |

- Each expression is always contained within a pair of double "curly" brackets {{ }}
- There should be a space between the first instance of AVG and the last bracket
- Variables you are using are case sensitive
- Always close the AVG operation with brackets ( )

This setup for the Average will work using the single operator (,) for a list of fields you wish to find the average for together. An example of using this setup would be when you are looking to find the average of a list of items within a table or to find the average of the a list of total scores.

AVG of Select Cells |
{{ AVG(q1[0],q1[2],[q1[3]) }} |
Based on Grid Indexing, this will give you the average of the 1st, 3rd, and 4th cells. |

AVG of a Column |
{{ AVG(q1[:0]) }} |
Based on Grid Indexing, this will find the average of column 1. |

AVG of a Row |
{{ AVG(q2[1:]) }} |
Based on Grid Indexing, this will find the average of row 2. |

AVG of a Range |
{{ AVG(q1[0:4]) }} |
Based on Grid Indexing, this will give you the average of the first 4 cells. |

AVG of the Reviewer's Scores |
{{ AVG(q1.score,q2.score,q3.score) }} |
The Average score of the 3 questions will be calculated. |

While you can use the Average function to find averages throughout a form task, it would not be possible to **pull an average of a list of averages** within the the same expression.

For example: {{ AVG(AVG(q1[:0]),AVG(q2[:0])) }} is **not** a valid expression.

**NOTE:** Calculate an average of averages can still be done using AEP. To do so would require the use of **in form piping** of the calculated average into a new average expression on a **following page**.