## Calculations

### What is a Calculation?

Calculations allow values to be calculated based on other form items. To add a Calculation to your form, edit your form and add a Calculation item, from the Specialty Items category.

### Equations

Calculations' values are calculated from equations that 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 of other form items.**+**addition.**-**subtraction.*****multiplication.**/**division.**(****)**parenthesis for grouping operations.

### Values

You can set how items' values are determined by editing an item 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 that the item is worth when answered correctly. When answered incorrectly, it is 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 possible 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 the user enters (case insensitive).

Text items additionally have a "Directly" mode. The "Directly" mode allows 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's equation, use the "Add Item to Equation" option to look up an item's Calc Code. Then, copy/paste the Calc Code into your equation.

### Evaluation

Equations are evaluated from 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 filling out your form. If you edit your form and change a Calculation's equation, existing stored results will not be updated to reflect 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.

### Additional Information

Use the "Include in Order Total" and "Include in Scoring Total" settings to customize Order Forms and Scoring.

## Let's get social