## Thursday, 26 July 2012

### Excel IF Condition Syntax and Example

Excel IF Conditional Function
IF is a conditional function, based on the given condition or logical test it written either TRUE statement(if the condition is true) or FALSE statement(if the condition fails).

Syntax:
=IF(Condition, TrueValue,FalseValue)
Where:
• Ø  Condition is what you want to test (Eg: a=b, a<b, a<=b, a>=b,…).
• Ø  TrueValue  refers to true statement.
• Ø  FalsValue   refers to true statement
Example:
Suppose cell ‘A2’ has a value 10 and cell ‘B2’ has a value 12 . Now if you want test whether A2 is greater than B2 or not., and you want the True statement as ‘Greater’ and False statement as ‘lesser’, then you have to write the following formula in  Cell C2 as shown below.

=IF(A2>B2,”Greater”,”lesser”)
Here True and False statement should be in double quotes because they are strings.

 VALUE_I VALUE_I IF CONDITION Result 10 12 =IF(A2>B2,"Greater","Lesser") Lesser

Note:
In the above Formula in the example, IF condition fails so that it will written the result as “lesser”.

Thanks,
TAMATAM