All Collections
Projects
Formula Builder - Mathematical Operators
Formula Builder - Mathematical Operators
Narine avatar
Written by Narine
Updated over a week ago

Basic Mathematical Operators

Using formula builder you can use basic as well as advanced operators like +, -, x, and / by typing them out on the keyboard. You can easily build simple quota or cost calculators with these operators.

Basic Addition

Q1 = score in the first question
Q2 = score in the second question
Q3 = score in the third question
$Result$ = Total score
So formula for $Result$ = Q1+Q2+Q3

Basic Multiplication

Q1 = number of books you have
Q2 = value of each book
The total value of books = Q1*Q2

Max and Min functions

Max function will return maximum value from the given list of values:
For example:
Q1=6
Q2=8
Q3=3
Using Max(Q1, Q2, Q3) we get 8
This will return maximum value from the given list of values:
For example:
Q1=5
Q2=6
Q3=2
Using Min(Q1, Q2, Q3) we get 2

If statement

Let us understand this with a real-life example, say a person needs a minimum of 50 points to pass an examination else you fail. Let's say Q1 + Q2 + Q3 is your score and we want to give a 100 to a passing score and 0 for a failing score.
The following equation should be used in the formula builder to build this logic in the calculator.
(((Q1+Q2+Q3)>=50)? 100 : 0)

If statement with AND

There might be scenarios where you would want the output of a calculation to depend on 2 values for example if (Q1) is 1 and the second answer (Q2) is 2; then we use in If statement with AND as shown here:
(((Q1==1)and(Q2==2))?(5xQ1):(3xQ1))

If-Then-Else Statements

To use conditional expressions, you need to use a formula of type x ? y : z. Let's use it in an example to better understand:
Say we are trying to access the risk of you hitting your head on the ceiling and it depends on your height. So you will ask a question "What is your height?" and on the basis of the answer assign a risk value.
The expression will take the form: If my height is > 6 feet then my risk of hitting my head on the roof is 90%, else it is 50%. To write this expression is the formula builder, just write:
Q1>6?90:50
Here, "?" becomes the expression for "then", and ":" becomes the expression for "else".

Nested If

Let's say a person needs a minimum of 50 marks to pass an examination. Now if marks are greater than 80 then he passes with distinction and if marks are greater than 50 he passes else fails so understand this in the equation where. Now his score is the sum of the first 3 question values. We want to have distinct values associated with each option so pass with distinction can have value 1, the pass has value 2, and fail has value 3
The formula used to find out if a person passed with distinction, just passed, or failed will be
((Q1+Q2+Q3)>80)?1:((Q1+Q2+Q3)>50)?2:3

Round Function

Let’s say you want to display only rounded off values in the results.
For example, you want to display 7 instead of 6.87 that was calculated through Q1xQ2/Q3, then use round(Q1xQ2/Q3).

By default, we round values to integer, but you can set your own number of decimals.

If you want to have results with for example 3 decimals you can use round((Q1xQ2/Q3),3)

This is a classical round so if there is 8.6 and you want to round to integer it will round to 9 if there is 8.4 it will round to 8. Round a value towards plus infinity or minus infinity you can use roundUP or roundDown functions

Log Function

As an example let's say if Q1 = 1000, and we need to find the logarithmic value of Q1 then we can use the following formula in our calculator;
log(Q1)
In this case, the result will be 3

Power function

Calculate the power of x to y, power (x,y)

As an example let's say that you have a base number in Q1 and an exponent in Q2
So the formula for this will be

power(Q1,Q2)

Did this answer your question?