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 allow you to calculate and display scores, totals, or other custom outputs based on user input.

These fields are highly versatile and can be used for various purposes, such as score calculations in quizzes, pricing estimations, and more.

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 Formaloo to create a form or survey.

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

  3. Assign a unique ID to the variable field. This ID is essential for referencing formulas and displaying calculated values.

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

Step 2: Add scores to each question

To assign scores to each question, you'll need to set up advanced logic for each quiz question:

  1. Select the question you want to score and click on the Logic tab in the right sidebar.

  2. In the Advanced Logic section, click + Add Condition to set the logic for each correct answer. For example, if the answer is Option 1, assign a score of 5 to that option.

    Add score in logic

  3. 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.

Step 3: Add Variable fields to calculate the total score

  1. Create separate variable fields for each category and assign them unique IDs. (e.g., math_score, science_score).

    variable

  2. 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 (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.

Ending page with answer piping

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 80, show Ending Page 1 (e.g., congratulatory message).

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

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

To create multiple ending pages:

  1. Add a new ending page:
    After adding your form's content, click the + icon on the lower left side of the form editor to add a new ending page.

    multiple success 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 80, create a page with a congratulatory message. Example: "Your total score is @total_score. Congratulations on passing!"

    • Improve page: For a score between 50 and 80, 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 50, 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 logic tab in the form editor.

  2. Click on the "Advanced Logic" button.

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

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

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

    • Condition 3: If the total score is between 50 and 80, 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.

Did this answer your question?