Calculating percentages can be useful for various purposes such as analyzing survey results, tracking progress, or generating reports.
What is a variable field?
A variable field stores calculated data that can be used dynamically within your form.
You can set it to calculate percentages, scores, and other dynamic values based on user input.
⭐ Pro Tip:
Formula without parentheses
Please note: Parentheses are not supported in the formula variables. When setting up formulas, avoid using parentheses and instead follow a step-by-step approach by creating separate variables for each part of the calculation.
For example, to calculate the percentage of a certain value relative to another value, the formula would be:
(Value A / Value B) * 100
Follow these steps to see how to calculate the percentage value:
Example 1: Calculate the percentage using a formula
In this example, we will calculate the percentage of Value 1 out of Value 2.
Step 1: Create the fields
Value 1: Add a Number field with the ID
valu1
.Value 2: Add a Number field with the ID
valu2
.
Step 2: Add the variable field
Add a variable field and select Formula in the "Type" dropdown in the field settings on the right-side menu.
In the Default value field, enter the formula to calculate the ratio of
Value 1
overValue 2
:Formula:
value1 / value2
ID: Assign an ID to this variable field, for example,
value1_value2_ratio
.
Step 3: Add the second variable field for the percentage
Add another Variable Field and select Formula in the "Type" dropdown.
In the Default value field, enter the formula to calculate the percentage:
Formula:
value1_value2_ratio * 100
ID: Assign an ID to this variable field, for example,
total_percentage
.
Step 4: Display the result
Once the form is filled out, the second variable field will calculate the percentage based on the two values (Value 1
and Value 2
). The result will be displayed automatically as the total percentage.
For example, if Value 1
is 2 and Value 2
is 20, the formula will calculate:
(2 / 20) * 100 = 10%
The calculated percentage (10%) will be displayed dynamically in the form after submission.
Example 2: Deductible percentage calculation using variables and logic
In an insurance estimation form, calculating the deductible percentage is essential for determining the portion of the coverage amount that the insured individual is responsible for covering before the insurance provider begins to pay out benefits.
Formula:
(Deductible Amount / Total Coverage Amount) * 100
Step 1: Create the fields
Add two Number fields: Deductible Amount and Total Coverage Amount.
Assign appropriate IDs for both fields (e.g.,
deductible
andtotalcoverage
).
Step 2: Add the first variable field
Add a Variable Field and select Formula in the "Type" dropdown.
In the Default value field, enter the formula to calculate the ratio of the deductible to coverage:
Formula:
deductible / totalcoverage
ID: Assign an ID to this variable field, for example,
deductible_ratio
.
Step 3: Add the second variable field for the deductible percentage
Add another Variable Field and select Formula in the "Type" dropdown.
In the Default value field, enter the formula to calculate the deductible percentage:
Formula:
deductible_ratio * 100
ID: Assign an ID to this variable field, for example,
deductible_percentage
.
Step 4: Display the result
In the form view, enter values for Deductible Amount and Total Coverage Amount.
For example:
Deductible Amount = $500
Total Coverage Amount = $10,000
The variable field will calculate:
Deductible Percentage = ($500 / $10,000) * 100 = (0.05) * 100 = 5%
The calculated deductible percentage (5%) will be displayed dynamically in the form after submission.
In this scenario, the deductible percentage is 5%, meaning the insured individual is responsible for covering 5% of the total coverage amount as the deductible.
Example 3: Calculate the final amount after applying a discount code
When a user applies a discount code, you can easily calculate the final price by deducting a percentage from the total amount.
Step 1: Create the form fields:
Add a Number field for the total price (e.g., total_price).
Add a variable field to calculate the final price after the discount.
Step 2: Formula for calculating the final amount:
In the default value field of the variable field, use the formula:
total_price*0.95
This formula subtracts 5% from the total price. If the total price is $300 and the discount is 5%, the final amount will be calculated as:
Total price: $300
Discount percentage: 5%
Final amount: $300 * (1 - 0.05) = $300 * 0.95 = $285
The final amount of $285 will be dynamically calculated and displayed after the user applies the discount.
🧩 Template:
For a ready-made solution, you can use this Return on investment (ROI) calculator template to easily calculate and track your investment returns. Feel free to customize it for your specific investment goals.