# How do I conditionally return different value from a Cognito Forms calculation?

I have an if then question. If two numbers equal 50 then `0`. If two numbers equal < 50 then I need the sum of those numbers to be the result.

You can write conditional calculations in Cognito Forms in two ways:

1. Use `if` `condition` `then` `true result` `else` `false result`
2. Use `condition` `?` `true result` `:` `false result`

In your case, let's assume you have two number fields, `Number1` and `Number2`. In this case the calculation would be:

`=if Number1 + Number2 = 50 then 0 else if Number1 + Number2 < 50 then Number1 + Number2 else ???`

In the example above, I left `???` in place for the required final else, because I do not know from your question what should happen when the two numbers are greater than 50. If this is never going to be possible, then you could use the following less complex calculation:

`=if Number1 + Number2 = 50 then 0 else Number1 + Number2`

• I need a return of 0 if the result is > 50 but if the number is < 50 I need the result subtracted from 50 Feb 3, 2016 at 21:58
• I need a return of 0 if the result is > 50 but if the number is < 50 I need the result subtracted from 50 Feb 3, 2016 at 22:05
• sorry having internet connection problems Feb 3, 2016 at 22:11