Skip to main content
Answer

How to do "math"

  • October 24, 2025
  • 5 replies
  • 58 views

I can’t figure out how to perform a calculation on a form. Here’s a simple example. 

 

Slide 1 (number) “How many names do you have in your email list?” _______ (100 for example)

 

on Slide 2 I want to do math in the background and show 80% of the number entered in slide #1. 

 

so Slide 2 would say “Factored leads 80”   ( the number entered in slide 1 * 0.8)

 

I can’t find clear instructions to do this, any help would be much appreciated. 

Best answer by john.desborough

@BBD246 - start by creating a custom variable to hold the calculation value - say v_factored

to do that, click on the Workflow tab and then the variables icon

now you’re going to Add a Custom Variable

enter in the name of the variable, leave it as ‘number’ with the default = 0 and Save by clicking the button on the bottom

 

how you have a placeholder to do the calculations

on  your second page, where you want to display the calculated value, you need to use the @recall function to have the variable displayed: 

i just created a simple Statement page and as you can see, when you type the @ sign, the available answers and variables are there for you to select. Choose the variable and you should see the page looking like this 

now for the calculation. 

you need to put a logic rule in place on question 1. 

 

Go to the Workflow tab again and choose Branching and you will see a screen like this: 

now click on the Add rule link for Question 1

we’re going to add 3 rules the page - one to put the answer from q1 into the variable: 

note that you should probably set the initial condition to if the mailing list is greater than 0, which is what i set in this example. then you choose the operation for the Then (Add)  what (the value from q1) to what (the variable) … you select those values from the drop downs. 

next we’re gong to multiply the value of the variable by the factor - and this is where i wish Typeform would allow for the use of decimal values in the calculations, but they don’t. 

In order to get the ‘factored value) ie multiply by .8, you have to do it in two steps….as seen in the image below

now when you save and run the form, you should get the value of 80 showing up on page two if you put in 100 

 

it ain’t pretty but it works

des

5 replies

john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • Answer
  • October 24, 2025

@BBD246 - start by creating a custom variable to hold the calculation value - say v_factored

to do that, click on the Workflow tab and then the variables icon

now you’re going to Add a Custom Variable

enter in the name of the variable, leave it as ‘number’ with the default = 0 and Save by clicking the button on the bottom

 

how you have a placeholder to do the calculations

on  your second page, where you want to display the calculated value, you need to use the @recall function to have the variable displayed: 

i just created a simple Statement page and as you can see, when you type the @ sign, the available answers and variables are there for you to select. Choose the variable and you should see the page looking like this 

now for the calculation. 

you need to put a logic rule in place on question 1. 

 

Go to the Workflow tab again and choose Branching and you will see a screen like this: 

now click on the Add rule link for Question 1

we’re going to add 3 rules the page - one to put the answer from q1 into the variable: 

note that you should probably set the initial condition to if the mailing list is greater than 0, which is what i set in this example. then you choose the operation for the Then (Add)  what (the value from q1) to what (the variable) … you select those values from the drop downs. 

next we’re gong to multiply the value of the variable by the factor - and this is where i wish Typeform would allow for the use of decimal values in the calculations, but they don’t. 

In order to get the ‘factored value) ie multiply by .8, you have to do it in two steps….as seen in the image below

now when you save and run the form, you should get the value of 80 showing up on page two if you put in 100 

 

it ain’t pretty but it works

des


  • Author
  • Explorer
  • October 27, 2025

THANK YOU John!  This process is not very straightforward but your explanation helped me figure it out. Very helpful, thanks again 😎


  • Author
  • Explorer
  • October 27, 2025

Follow up question ​@john.desborough 

I create a variable, do the math and it renders the number that I want to display on my form. All good.

Let’s say that I want to display that number as $20,000.  

Is there a way to format the variable to be displayed on the form with a dollar sign and a comma so it appears as $20,000 vs. 20000?

 

THANK YOU! 


john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • October 27, 2025

@BBD246 unfortunately no. all you can do is put something like this on the page: $@recall_variable

which would add the $ just in front of the number but no other formatting

you might also want to look at something like dividing the variable by 1000 and using this: $@recall_variable K

 

so that it would show up as $21.4 K as an example. 

not perfect but… 

 


  • Author
  • Explorer
  • October 28, 2025

Ugh, ok thank you!  Strange that Typeform hasn’t addressed basic formatting like commas or multiplication by percentages/decimals. Appreciate your help John.