# IF Statements

In some situations you might want to use different calculations for a formula depending on the result of another calculation. This is where you can use "IF statements".

Last updated: July 22, 2022

Example use cases of IF statements:

• Check if multiple budgets have all been reached

While it can appear pretty difficult to make IF statements, it's something that anyone can do with a little training. In Plecto, IF statements work the same way as Excel.

(
IF([condition],[if_true],[if_false])
)

For instance, if you want to show whether any sales has been made, you could use the following formula:

(
IF(Count(Sales)>0,1,0)
)

So… If the No. of Sales is greater than 0…

IF it is true that it is >0 output = 1

IF it is false that it is >0 output =0

You can also have the outcome showing YES/NO:

E.g. (IF(Count,(Sales))>0,1,0)

IF it is true that it is >0 output = Yes

IF it is false that it is >0 output = No

(Just remember to change the data format to Yes/No)

You can include additional IF statements inside an IF statements if_false/if_true fields. Example:

(
IF(Count(Sales) > 0,

IF(Sum(Sales) > 0, 1, 0),

0)
)

In this case we check whether the number of sales is larger than 0 and also if the sum of sales is larger than 0. If both things are true the formula will return 1 otherwise it will return 0.