# Perform Calculations

A formula field is used to automatically perform calculations in your form. You can use this to total up costs, grade quizzes, and more.

To include a formula in your form:

• Click the formula field under the Advanced Fields section.
• In the pop-up, your form's fields would appear in the left pane. Use the fields, numbers, and operators to come up with your formula.
• When your respondents fill in the form, calculations would be performed based on their input and the answer is displayed in this field you entered the formula in. You can even choose to hide this field from your respondents by clicking on the hide field checkbox. You will find it under the Properties pane in the builder.
If you wish to edit your formula, click on the Edit formula button under the Properties pane.

### To calculate a payment amount using formulas:

Senario: You want to create order forms, you can calculate the amount your customer has to pay using the formula field and display the amount in the payment field automatically.

Set the formula as: price of product * quantity

You can even use a formula field as a variable for calculating another formula. If you do this, make sure the two formulas aren't mutually dependent.

## Cyclic Dependency

If you've come across the error because two formulas being mutually dependent, then this is the problem is as outlined below:

For example, n1, n2, n3 are three number fields, and f1, f2, f3 are the formulas that you've created.

The formulas:

f1= n1+ n2
f2 = n3 + f3
f3= f1 + f2

Formula 2 depends on Formula 3's answer (and vice versa) to perform calculations, resulting in an endless loop.

Recheck your formula to ensure you avoid this type of infinite loop.