How Formulas Work

Formulas are what separate the calculator from a regular form. They transform what the user inputs into the calculator into a result that helps them in some way. For example, the user will enter their age in a Number field, and the Formula field will show how many years until they retire (Formula would be something like: 65 - @Age)

Note: Formulas don't start with the equal sign (like in Excel), it's not "=65 - @Age", but just "65 - @Age"

Here are the elements you can use in a formula:

Numbers

Numbers can contain digits or the decimal point (no commas or spaces).
Note 1: You can't use decimals like .5 it has to be 0.5
Note 2: You can only use the dot as a decimal point, no comma anywhere in the number: 1,000 or 2,5 will not work

Operators: +, -, *, /, ^

Just like an Excel or any other Math formula, you use operators to calculate something.
For example, you can write

1.5 * 2 + 3
And the formula result will show 6

Question Values

This is where the formulas get powerful. Every question in the calculator has a numberic value at all times. You can use the question values in your formula to calcualte something meaningful, for example:

65 - @Age
to calculate the years until retirement (assuming you retire at 65).

Functions

Sooner or later you will need functions to calculate anything more meaningful.
Some examples of functions are IF, OR, AND (most of the functions you may be familiar with from Excel will work)

For example in our years until retirement example, you may have a different retirement age based on the person's gender. So you can add a Radio Buttons field called Gender that has 2 options (Man: value=1, Woman: value=2).
Now the formula will be:

IF( @Gender = 1, 65, 63 ) - @Age
So we use the IF function to return 65 when the Gender field's value is 1 (so Man is selected) or 63 when the value is 2 (so Woman is selected)

Learn more about functions here.

Variables

When editing a formula you will see two tabs above the formula editor: Variables and Tables.
Variables are a way to store a formula that you can use in other formulas. So for example you can have a variable called Variable1 that is:

IF( @Gender = 1, 65, 63 ) - @Age
Then you can have a formula called "Months left to work":
@Variable1 * 12
Tip: You can also use a regular Formula field the same way as a variable, just check it's Conditional Visibility tick box and leave it always hidden (don't enter anything in the Conditional Visibility). That way the Formula will never be visible in the calculator but you can use it's value in other formulas.

Tables

You can store data in tables that work similarly to Excel. Then you can use those tables in your formulas. Learn more about Tables.

Need Help?
Already checked the help docs? We're quick to answer and friendly
Thanks!
We'll reply very soon at
Send message