# Formula [Math]

## Basic Mathematical Operators

You can use basic as well as advanced operators like +, -, x, ^ and / by typing them out on the keyboard. You can easily build simple cost and savings calculators with these operators.

Q1 = score in maths
Q2 = score in science
Q3 = score in English
R1 = Total score
So formula for R1 = Q1+Q2+Q3

## Basic Multiplication

Q1 = number of chocolates you own
Q2 = value of each chocolate
Total value of chocolates = Q1*Q2

## Max and Min functions

Max function will return maximum value from the given list of values:
For example:
Q1=5
Q2=6
Q3=2
Using Max(Q1, Q2, Q3) we get 6
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 35 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)>=35)? 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 35 marks to pass an examination. Now if marks are greater than 70 then he passes with distinction and if marks are greater than 35 he passes else fails so understand this in the equation where. Now his score is the sum of the first 5 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+Q4+Q5)>35)?(((Q1+Q2+Q3+Q4+Q5)>70)?1: 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.8 that was calculated through Q1xQ2/Q3, then use round(Q1xQ2/Q3). This will always show non-decimal values or values rounded to the nearest integer.

## 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

As an example let's take Mortgage monthly repayment
Let's suppose in our calculator we have:
Q1 - Loan amount
Q2 - Interest rate
Q3 - Number of months
Then Monthly Payment formula is Q1x(Q2/1200x(1+Q2/1200)^(Q3x12))/((1+Q2/1200)^(Q3x12)-1)

## Other Operators

For other advanced operators, please see the documentation for operators here and functions here.

In case the documentation below doesn't answer your questions about your formula, feel free to email [email protected] if you need any help with the formula. We will be delighted to help :)