This example will explain how to do a BMI calculation using number fields and functions.

1. Add two **Number**** **fields to capture the participant's height and weight respectively.

- Rename the fields to e.g. '
*height*' and '*weight*' - For each of these, select the '
*Decimal*' answer format on the*Basics*tab.

2. Add a * Calculated Value* field to calculate (but not display) the participant's BMI using the responses to the two

*Number*fields added above and BMI = weight (kg) / (height (m))

^{2}

- Type in the formula as "
**=$weight / pow($height, 2)**" - Select the '
*Decimal*' data type.

3. If you want to show the value of the BMI calculation to the fieldworker, add another field (e.g. an * Information *field) and reference the

*Calculated Value*field name.

- In this case, the "round" function was used to round the answer to one decimal place: simply type "
**=round($bmi_calculation, 1)**" in the display text.

On the fieldworker's handset, it will look as follows.

*Note:** If nothing was calculated (e.g. the field(s) on which the calculation are based was skipped), " NaN" (Not a Number) will be shown instead of a number.*

The calculated value can also be used as a source field to base skip logic on. For example, certain fields should only be asked if the participant's BMI is equal to or greater than 23.

- This field will be skipped if the value for BMI as calculated above is less than 23.