The if() function is used to analyze data, test whether or not it meets certain conditions and then act upon its decision. The if() function has three parameters 1. Logical_test, 2. Value_if_true and 3. Value_if_false. The syntax of if() function is as under:
= IF(logical_test, value_if_true, value_if_false)
For comparing two conditions (logical_test) Excel provides following LOGICAL OPERATORS:
- = Equal to
- <> Not Equal to
- > Greater Than
- < Less Than
- >= Greater Than or Equal To
- <= Less than or Equal To
Value_if_true is the value to be returned if the result of logical test is true.
Value_if_false is the value to be returned if the result of logical test is false.
If cell A1 contains 65 and we use function =if(A1>60, “Yes”, “No”) then it will return “Yes” and if we use function =if(A1<60, “Yes”, “No”) then it will return “No”.