**Calculated responses** work well in calculating answers based on already collected responses. The current variables that it supports are:

- date response type (i.e calculating age based off of two dates)
- numeric response type (i.e calculating BMI based off of weight and height)

## Calculated Responses based on Date Response Types

Given that there are two date response questions already on the form such as **Date of Event **and **Date of Intake, **we can calculate age in various increments by utilizing calculated response type.

Equations for various increments:

**Age in Days**--> (date of intake - date of event) / (24*60*60)**Age in Weeks**--> (date of intake - date of event) / (24*60*60*7)**Age in Months**--> (date of intake - date of event) / (24*60*60*29.5)**Age in Years**--> (date of intake - date of event) / (24*60*60*365)

View during data collection once both date responses have been inputted:

## Calculated Responses based on Numeric Response Types

Given that we've already created two questions asking for age and height, let's add a new calculated response type question by selecting **Add Question** and **Calculated Response** for response type.

We can label this question *"Age to height ratio"* and begin writing out the equation within the small box that reads *Perform arithmetic manipulation of previously entered numeric responses*. We've already created numeric questions asking for age and height, so we can use them as variables to calculate this new question.

When we begin to type the question, questions will appear as options below. Once we select the exact question, the variable will appear as within an oval, ensuring that it has been properly selected. We can then add the /** **symbol for division and enter the height variable as well.

This is how the equation should look with typed and selected variable names.

This is how the equation should **NOT** look like. If the calculated response is not correctly written, a warning will appear below **Name not found! Your calculation will not be saved until fixed. **

Symbols accepted for calculated responses are:

- + for addition
**-**for subtraction- * for multiplication
- / for division
- ^ for raising numbers to a power ( ex. 2^2=4)
- () for order of operations

Now let's try making a more complicated equation with the symbols mentioned before:

There are also a few functions that can be used within calculated responses:

**LN**- natural logarithm of x where base is e, LN(x) = LOGe (x)**LOG10**- Log base 10, LOG10(x)**LOG**- log with base user can select, LOG(x, y) where x is variable and y is base**SQRT**- square root of a number, SQRT(x)

Now let's try making a calculated response with one of the functions. Once again, we can begin by typing in the function name and must select it once it appears in the options below. Then the function will appear within the box, and we can add and select the variable height in the same way.

This is how the calculated response should look:

This is how the calculated response should **NOT** look:

**LOG10**, **LN**, and **SQRT** all only require one argument within the (), however the LOG requires two arguments. As we can see in the figure below it needs a variable as well as the set log base after a comma.

Once we've finished building out the calculated responses on the web platform, let's see how it'll look on the mobile platform!

When we input **32** for *"What is your age?"* we automatically see the comment *Please answer 'What is your height in inches?' to view the calculation 'Age to height ratio,' *letting us know that another question's input is needed to finish the calculated responses.

Once we input an answer for *"What is your height in inches?"*, we see that the calculated responses for **Complex equation** and **Square root of height** are automatically calculated as the both variables it needs are now answered. However, we also see that the *Age to height ratio* now has a new comment that reads *Division by zero/undefined encountered!!* It is letting us know that the value is calculating to an undefined response.

Let's change the answer for* "What is your height in inches?" * to **67**, we can now see that Age to height ratio calculates to a response!