How to Compare Two Number Fields in Typeform Logic? | Community
Skip to main content
Answered

How to Compare Two Number Fields in Typeform Logic?


vivekthakur.b2b

I want to compare two number inputs from users and show different endings based on their responses.

 

Example:

What is your total marks in Physics? [Number field]

What is your total marks in Mathematics? [Number field]

 

Desired Logic:

If maths_marks > physics_marks → Show Ending: "Best option for you: BSc degree from Oxford"

If physics_marks > maths_marks → Show Ending: "Best option for you: Physics degree from MIT

Best answer by john.desborough

@vivekthakur.b2b  

create a custom variable like’ v_compare

logic rules:

  • if maths_mark greater than 0 add maths_mark to v_compare
  • if physics_mark greater than 0 subtract physics_mark from v_compare
  • if v_compare greater than 0 go to maths end page else go to physics end page

that doesn’t include the evaluation for a tie though.. but you should be able fo figure that out now.. 

 

des

View original

2 replies

john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • 5258 replies
  • Answer
  • March 3, 2025

@vivekthakur.b2b  

create a custom variable like’ v_compare

logic rules:

  • if maths_mark greater than 0 add maths_mark to v_compare
  • if physics_mark greater than 0 subtract physics_mark from v_compare
  • if v_compare greater than 0 go to maths end page else go to physics end page

that doesn’t include the evaluation for a tie though.. but you should be able fo figure that out now.. 

 

des


vivekthakur.b2b

@john.desborough Super Thanks!


Reply