Cognito-forms – How to sum quantities in a repeating section

cognito-forms

I have a quantity field in a repeating section. I need to determine the total of that field outside of the section. How do I sum up the quantity of items inside the repeating section in Cognito Forms.

Best Answer

I am a developer with Cognito Forms

The easiest way to total up the quantity across all items in a repeating section is to leverage a calculation field to sum up the total.

For example, if you have a repeating section called "Products" and within each item you have a number field called "Quantity", you can create a calculation field outside of the repeating section. The calculation would simply be =Products.Sum(Quantity). Make sure to set the Type of the calculation field to be "Number" so that the value is formatted correctly.enter image description here

I've included a screen shot a basic form that illustrates this setup.

You can also find this, and other powerful calculations in our help documentation at: http://help.cognitoforms.com/calculations-overview, check out the section on "Working with Repeating Sections".