A calculated value is a number your quiz works out from your customers' answers, like a BMI from their height and weight, a daily dose from a pet's weight and age, or a score. You write the formula once. The quiz calculates the value as soon as the answers it needs are in, and saves it like any other answer.
This article shows how to set one up, using a BMI quiz as the example, and the three ways to use the result: showing it to the customer, choosing which questions they see, and recommending products by range.
What you can do with a calculated value
Show it in any question title, description, content block or the Results page heading, for example Your BMI is {{ bmi }}.
Compare it in Skip/Show conditions, with the new greater than and less than options, to show a page only to some customers.
Recommend products by range with a question set to Answer automatically: one answer per range (for example Underweight, Healthy weight, Overweight), each with its own products.
Send it to your email tools, webhooks, Zapier and Shopify Flow together with the other answers.
Step 1: Ask for height and weight
A number slider can now show units, so customers answer in the units they know and your formula still gets one consistent number.
In the Quiz Builder, click Add Page and choose Slider - Number range.
Give the question a Property ID in General Settings, for example height. The formula uses this name.
Open Slider Settings and set Units to Height (cm or ft, in). A range of 120 to 220 cm is filled in for you if the slider still has its 0 to 10 range.
Choose what Shoppers see first: cm, or ft, in.
Add a second slider for weight with the Property ID weight and Units set to Weight (kg or lb). Tick Offer stone and pounds (st, lb) if you sell to customers in the UK or Ireland.
Customers see a small switch above the slider (cm | ft, in or kg | lb | st, lb) and their value written out, for example 5 ft 7 in. Once they switch units, their next height or weight slider opens in the same units.
Whatever unit the customer picks, the answer is always saved in cm or kg. That's why you set the slider's range in cm or kg, and why one formula works for every customer. What the customer entered is also saved, as text, under the Property ID followed by _entered (for example height_entered = 5 ft 7 in), in case you want to show it back or send it to your email tool.
Step 2: Add the calculated value
In the Quiz Builder, click Calculated values in the left menu, under Quiz text.
Click Add BMI. It fills in the name bmi, the formula weight / (height / 100)^2 with your own height and weight sliders' Property IDs, and rounds to 1 decimal. For anything else, click Add calculated value and fill in the fields yourself.
Under Try it, type sample answers to check the result before your customers see it. A weight of 70 and a height of 170 give 24.2.
The Name is how you refer to the value everywhere else: {{ bmi }} in text, and bmi in conditions. It can use letters, digits and _, and can't be the same as a question's Property ID. Round to sets how many decimals the saved value keeps.
Changes are saved to your draft as you type. Publish the quiz to make them live.
Writing formulas
A formula can use:
Property IDs of earlier questions, like weight. If a Property ID contains anything other than letters, digits and _, put it in curly braces: {dog-weight}.
Other calculated values listed above it in the Calculated values menu.
Numbers, with a point for decimals: 2.2, not 2,2.
+ - * / for add, subtract, multiply and divide, % for the remainder, ^ for powers (height^2) and parentheses.
Functions: sqrt (square root), pow, exp, ln (natural log), log10, log (log(x) is base 10, log(x, 2) is base 2), abs, min, max, round (round(x, 1) keeps 1 decimal), floor, ceil, and the constants pi and e.
A choice question counts with its answer's assigned value, so give those answers numbers. For example, a pet food quiz could give the answers to "How active is your dog?" the values 1.0, 1.5 and 2.5, and multiply by them.
The value stays empty when an answer it needs is missing or isn't a number (a text answer, or an answer from a multiple choice question), or when the formula divides by zero. A condition that compares an empty value is never met.
Step 3: Show the result
Type the value's name between double curly braces in any text the customer sees after the answers it needs: a question title, a transition page, a content block, or the Results page heading and description. For more on showing answers in text, see How to use customer answers in Lantern quizzes.
In the example below, the Results page heading is Your BMI: {{ bmi | default: "calculated" }} and the description is You're in the {{ bmi_range | lowercase }} range. Here's what we recommend for you. The default filter sets the text shown if the value is empty, and bmi_range is the Property ID of the question from Step 4.
Step 4: Recommend products by range with Answer automatically
Products are connected to answers, so to recommend products by BMI range you add a question whose answers are the ranges, and let the quiz answer it for the customer.
Add a Single choice question, for example BMI range, with one answer per range: Underweight, Healthy weight, Overweight, Obese. Give it a Property ID, for example bmi_range, if you want to show the range in text or send it to your email tool.
Hover each answer, click the eye icon and add its rule: Show the answer if all of the conditions are met, for example bmi is greater than or equal to 18.5 and bmi is less than 25 for Healthy weight.
Connect products to each answer as usual on the Products page. See Product Matching.
In Question Properties on the right, tick Answer automatically.
Customers never see this question. When they reach it, the quiz picks the first answer whose rule is met and moves straight on. On a multiple choice question it picks every answer whose rule is met. An answer without a rule is always picked, so leave rules off only for an answer you want everyone to get.
The picked answer is an ordinary answer. It recommends its products and counts toward the match score, it can jump to another page with Logic Jumps, it can choose which Dynamic Content Blocks variant shows, and it appears in your answer stats and integrations. It isn't counted in the progress bar, and the Back button passes over it.
Compare numbers in Skip/Show conditions
Skip/Show conditions and Skip/Show conditions for individual answers now have four more options next to exactly, at least, one of and provided: greater than, greater than or equal to, less than and less than or equal to. They compare the answer as a number with the one number you type. They work with calculated values, number sliders and answers that have a numeric assigned value.
For a range, add two conditions and choose all, as in the BMI example. If the answer isn't a number, the condition is not met, whether you choose is or is not.
Where the value is sent
A calculated value is sent together with the other answers, under its name:
Klaviyo, as a profile property and in the quiz event
Omnisend, as a custom property and in the quiz event
Mailchimp, as a merge field under the same name, like your other answers
Brevo, in the quiz event
Webhooks, Zapier and the Shopify Flow trigger
Brevo contact attributes, ActiveCampaign fields and Google Sheets columns only take answers from questions. To get a range into those, use the Answer automatically question from Step 4: its answer is sent like any other answer.
Test your quiz
Open your quiz's preview and try a few answers that land in each range, for example 170 cm with 50, 70, 80 and 95 kg for the four BMI ranges above. The preview shows your latest changes before they're live. When the results look right, publish the quiz. See How do I publish and test quizzes.
Sensitive data
A calculated value is as private as the answers it's worked out from. If the weight question is set to Don't share, the BMI isn't sent anywhere either. If it's Don't store, the BMI is also deleted once the results are generated. See Sensitive Data Controls for Quiz Answers.
For more tutorials and support, visit our website or contact our support team.






