Skip to main content

How to calculate multiple scores using variable fields

Learn how to calculate multiple scores, compare them, and display results dynamically using variable fields and logic.

Updated this week

Variable fields in Formaloo are powerful tools that let you calculate and display scores, totals, or other values based on user input.

If your form includes different categories, like math, reading, or personality types, you can calculate multiple scores by creating a separate variable field for each one.

This tutorial is perfect for:

  • Quizzes or personality tests that track points for different result types.

  • Performance reviews or skill assessments with separate category scores.

  • Multi-part evaluations, onboarding flows, or health checkups where each section needs its own total.

This tutorial will guide you step-by-step on how to set up variable fields for calculating scores in your forms and comparing them.

Step 1: Create a form with a variable field

  1. Navigate to your dashboard and click on + New to create a form or survey.

  2. Add various question fields (e.g., text fields, single-choice fields, and variable fields).

  3. Add variable fields to calculate the total score for each category.

4. Assign a unique ID to the variable field. This ID is essential for referencing formulas and displaying calculated values.(e.g., math_score, science_score).

For example, if you're creating a self-grading quiz, you'll need:

  • Short/long text fields for basic info

  • Single-choice fields for quiz questions

  • Content fields for section introductions

  • Variable fields for score calculation

📝 Additional insights:

You can edit a variable field’s name or ID anytime by clicking on the field in the right sidebar. If you update the ID, make sure to update it everywhere you’ve used it.

This ID can be used for answer piping, which lets you display the value of that variable inside messages, success pages, emails, PDFs and more.

Step 2: Add scores to each question

To assign scores for each question, you can use Logic in the form editor or Advanced Logic. In this tutorial, we’ll use Advanced Logic.

  1. Go to SettingsAdvanced Logic

  1. Select the field (question) you want to apply logic to

  2. Click + Add rule and set the rule for the correct answer

Example:

If the answer is Option 1, add 5 points to the corresponding score variable.

​Repeat this process for all quiz questions to ensure each answer is graded correctly.

📝 Additional Insights:

For a more detailed guide on adding scores and using logic in your quiz, check out our full tutorial on How to add and calculate scores in your quiz.

It will help you set up score assignments and grading logic for each question in your form.

💡 Tip:

You can add as many variables as you need directly from the Advanced Logic page too.

Step 3: Set up the formula for the total score:

  1. Set up the formula for the total score:

    • Create a Variable field to calculate the total score.

    • Select the type of variable field as Formula, and in the Default value section, use the sum of all score variables ( Make sure to use the correct variable field category ID, e.g., science_score + math_score + history_score).

    • Assign an ID to the total score field (e.g., total_score).

Step 4: Display the total score on the success page

Use answer piping: Use answer piping to dynamically display the total score on the success page by inserting the ID in the message like this:
Your Total Score is @total_score.

Add multiple ending pages (Optional):

If you want to display different results based on the total score, you can create multiple success pages.

For example:

  • If the total score is greater than 15, show Ending Page 1 (e.g., congratulatory message).

  • If the total score is less than 15 and greater than 10, show Ending Page 2 (e.g., improvement suggestions).

  • If the total score is less than 10, show Ending Page 3 ( e.g., fail page)

To create multiple ending pages:

  1. Add a new ending page:
    Click the + add ending on the lower left side of the form editor to add a new ending page.

  2. Customize each ending page:
    Create different messages for each ending page based on the user's score.

    • Pass page: For a score above 15, create a page with a congratulatory message. Example: "Your total score is @total_score. Congratulations on passing!"

    • Improve page: For a score between 10 and 15, create a page with improvement suggestions. Example: "Your total score is @total_score. Keep up the hard work, here are some resources to help you improve!"

    • Fail page: For a score below 10, create a page with a failure message. Example: "Your total score is @total_score. Unfortunately, you did not pass. Better luck next time!"

  3. Set the title for each ending page:
    On the right sidebar, enter the title for each page (e.g., Pass, Improve, Fail). These titles will later be referenced in the logic settings to determine which page is shown based on the user's score.

📝 Additional Insights:

Use logic to display multiple ending pages

To show different ending pages (Pass, Fail, Improve) based on the total score, follow these steps:

  1. Go to the Advanced Logic.

  2. Scroll to the "On Submitting The Form" section and add conditions like:

    • Condition 1: If the total score is greater than 15, show the Pass page (e.g., congratulatory message).

    • Condition 2: If the total score is less than 10, show the Fail page (e.g., message for improvement).

    • Condition 3: If the total score is between 10 and 15, show the Improve page (e.g., suggestions for improvement).

This ensures that users see personalized results based on their performance, guiding them toward the appropriate outcome.

📝 Additional Insights:

Whenever you want to compare form submissions or take action after a form is submitted, always add the rules to the "On Submit" trigger.
The On Submit trigger runs after the form is fully submitted, allowing you to redirect users to the correct page or apply conditional logic based on their responses.

💡Tip:

To avoid unexpected values, make sure to initialize your variable by setting its default value to 0. This ensures the total score is calculated correctly, even if some questions are left unanswered.

🔧 Troubleshooting:

If your total score isn’t updating correctly, double-check the following:

  • Field IDs match exactly across your formula, answer piping, and logic rules.

  • Logic rules are applied in the correct order.

  • All score fields are either marked as required or shown conditionally based on user input.

Did this answer your question?