# Adding a Calculated field

The following section describes how to add a Calculated field when designing a Form to automate calculations and get direct results out of other fields. You can write Formulas for your Calculated fields using Codes of other fields in the Formula editor.

You can use such Calculated fields in a variety of ways, such as:

- add, subtract, multiply and divide indicators
- find the count, count distinct, average, median, max, min of indicators
- search in text values
- concatenate (merge) text values
- use date functions
- use logical functions
- use geographic functions
- and many more!

Take a look at all the available Formulas in the Formulas Manual and read more on Writing an Expression.

Maximum length of a calculated field formula: **1024 characters**

- In the Form Designer, find the fields that you want to use in your calculations and add a Code to them to make them more readable in the Formula editor.

Maximum length of a field Code: **20 characters**

- Click on "Calculated" to select the field from the Fields tab.

Fill in the Properties of the Calculated field by providing:

- Label: give a descriptive label to the field
- Description: optionally provide a description
- Code: optionally provide a code

In the Settings check the boxes you want to apply for the field.

The Calculated field will not appear in the Data Entry Form to avoid confusing users adding Records. It will appear however in the Table View. To hide it from Table View make sure you tick the 'Hide from entry' Property.

If you set Relevance rules to the Field, then it will appear in Table View only if the conditions of the Relevance rules are met.

- In the Formula section add the Expression for your Formula. Use the codes you assigned to the fields you need.
- Make sure you Formula is verified. A verified Formula will be marked with Green. A Formula that is not correct will be marked with Red.
- Click on "Done" to add the field to the Form.

Take a look at all the available Formulas in the Formulas Manual and learn more about Writing an Expression.

- When you finish adding fields, click on "Save" to save the Form.

- Alternatively click on "Formula editor" in the Formula Section to navigate to the Formula Editor.

- The Formula editor provides you with a list of all available Functions and all available fields.
- Type your Formula in the Formula editor. Click on a field to directly select it. If you haven't assigned a code to it, it will appear as a number.

Take a look at all the available Formulas in the Formulas Manual and learn more about Writing an Expression.

- If you enter an invalid Formula you will get a warning.

- When you Formula is ready, click on "Done" to add it.

- Click on "Done" to add the field to the Form.
- When you finish adding fields, click on "Save" to save the Form.