Spread Sheets‎ > ‎

SS =If( , , )

The IF Statement

The if statement can be used to perform a logical text as part of a complex formula in a spreadsheet.  


=IF (Condition, TrueExpression, FalseExpression)

A logical expression representing the condition to be tested.
A numeric or string value representing the value to use if Condition is true.
A numeric or string value representing the value to use if Condition is false.

Logical Operators:
These are relational operators:
<   >   <=   >=   <>   =   

These are the boolean operators:

@IF(8=7,4,5) 5

@IF(B4<100,"Yes","No") Yes if B4 < 100; otherwise, No

@IF(C10=B5,45,50) 45 if C10 = the cell named B5; otherwise, 50

Nesting @functions
Aa @functionst can be placed inside of another @function.  When this is done it is call a nested  statement.  To nest a statement, just keep following the syntax rules of the statement, with on small exception.  The exception is that only one @ sign is needed for each formula.  
Notice that each of these example will product the exact same results.  There is more than one correct approach to solving any problem.

@IF(B4 = 70,”right on”, IF(B4<70,”too low”,”too high))
@IF(B4 > 70,”too high”, IF(B4=70,”right on”,”too low))
@IF(B4 < 70,”too low”, IF(B4>70,”too high,”too low))
@IF(B4 = 70,”right on”, IF(B4>70,”too high,”too low))
@IF(B4 >= 70, IF(B4>70,”too high,”right on”),too low)

The easiest to keep the brackets and commas straight is to always type:
  if bracket comma comma bracket ie If(      ,     ,    ) then keep filling in the parts of the funciton that need to be completed.

You can nest as many functions as you like in a formula (up to 1022 characters), but it is more difficult to debug complex function formulas if there is a problem.

This information originally from Quattro Pro Help