## What are Calculations?

Calculations allow you to create custom equations that calculate values from form items.

## Values

You can set how an item's value is determined by editing it and using its "Calculations" settings tab. For most items, you can choose between two different modes for assigning values: "Entire Item" and "Each Choice".

The "Entire Item" mode allows you to enter a single value the item is worth when answered correctly. When answered incorrectly, it's worth 0. Checkbox items additionally have a "Require Choices" option that can select between requiring one or more of the correct choices ("Any"), or requiring exactly all of the correct choices ("Exact").

The "Each Choice" mode allows you to enter a separate value for each answer choice. For multiple choice items, the item is worth the value associated with the choice the user chooses. For text items, the item is worth the value associated with the text (case insensitive) the user enters.

Text items additionally have a "Directly" mode. The "Directly" mode allows form users to directly enter, as a number, the value the item is worth.

After an item has been assigned its value(s), you can use it in a Calculation. In a Calculation item's equation, use the "Add item to equation" option to look up a form item's Calc Code. Then, copy/paste the Calc Code into your equation.

## Equations

Calculating form fields are calculated from equations you set up. Some general examples of equations are:

id1+ 10

id1+ 10 +id2

(id1+ 10 +id2) *id3

`id1`

,`id2`

, and`id3`

are Calc Codes that specify values from form items`+`

addition`-`

subtraction`*`

multiplication`/`

division`()`

parenthesis for grouping operations

## Equation Evaluation

Equations are evaluated left-to-right using the standard order of operations: multiplication and division happen before addition and subtraction. When a Calc Code is encountered, it is replaced with the value of the item it represents and evaluation continues.

If the value for a Calc Code is unavailable or invalid, a 0 value is used. If part of an equation evaluates to something invalid (like dividing by 0), the invalid part is discarded and a 0 value is used.

Equations are only evaluated when form users are completing your form. If you edit your form and change a Calculation's equation, existing stored results won't be updated or recalculated with the new equation.

## Decimals and Rounding

The "Decimals" setting controls the number of decimal places to use. The calculated value will always round to this number of decimal places, even if they are just zeros (for example, 1.00). Numbers are rounded using Half to Even rounding. Half to Even is the standard rounding method used for bookkeeping and finances.