Formula function uses the functionality from the eval function from Javascripts.

Use default values and required fields to ensure that your formula will work. If there is an error in the formula, the user won’t be able to answer the question and contunue.

If you need more complex calculations, more than one result variable, or need to use data from other objects, then call a flow and make your calculation there.