Skip to main content

How to use a variable field with a formula

Use variable fields to perform calculations automatically, whether for an area calculator, a donation form, quiz scoring, or a BMI test.

Updated over a month ago

Variable fields are hidden fields that store calculated values based on user inputs. You can reference them throughout your form using formulas and answer piping.

A variable field is used to:

  • Store a calculated value using a custom formula

  • Remain hidden from the user but used for logic or dynamic output

  • Be referenced in other fields or sections of your form

You can use variable fields in:

  • Area calculators

  • Donation forms

  • Quizzes

  • BMI tests

  • Logic-driven workflows

Example: Circle area calculator

Let’s build a form that calculates the area of a circle using the formula:
A = π × r²

Step 1: Create a new form

  1. Open your Formaloo dashboard

  2. Click + New Formaloo and choose to create a form from scratch

Step 2: Add required fields

Add the following fields to your form:

  1. Number field – For the radius input

    • Label: Radius

    • Set an ID (e.g., radius)

  2. Variable field – To perform the calculation

    • Type: Formula

    • Set an ID (e.g., area)

    • Default Value (formula): radius*radius*3.14159265359

  3. Content field – To show the result to the user

    • Content: Use answer piping: {{area}}

💡 The result will dynamically display the calculated area based on the input radius.

Displaying variable values with answer piping

To pass a variable field value to another part of the form:

  • Use answer piping by typing the variable ID inside double curly brackets (e.g., {{area}}) or @area

  • This works in content fields, email templates, and logic rules

More examples of variable fields

You can find other examples of variable fields in our tutorials.

Did this answer your question?