In this section, we have explained about commonly used logical function IF with different operators like >, AND, OR, NOT etc. You can see those different functions under FORMULASLOGICAL.
The IF Function has three arguments Logical_Test, Value_If_True, Value_If_False. In the formula, these three arguments are separated by COMMAS.
Argument 1 - Logical Test: What has to be tested?
Argument 2 - Value_If_True: If the tested condition returns a value TRUE, what has to be done?
Argument 3 - Value_If_False: If the tested condition returns a value FALSE, what has to be done
You can also use formula in argument 1 and argument 2 and argument 3.
IF Function and ">" Operator
Formula =IF((E13*12)>200000,"Tax Deduction","No Tax Deduction")
Name: John
Operator: >
Condition: When yearly salary is greater than 200,000, tax deduction applied.
Since John's yearly salary(120,000) is less than 200,000.
Result: No Tax Deduction
IF function and using "AND" Condition
Formula: =IF (AND (H17="y", G17>40),"Promotion OK","Wait for Promotion")
Name: Sheela
Operator: AND
Condition: If Gender is Y and age greater than 40. Since Sheela's gender is Y (condition satisfied) and age greater than 40 (condition not satisfied).
Result: Wait for Promotion
IF function and using "OR" Condition
Formula =IF(OR(H13="X", H13="Y"),"Promotion OK","Wait for Promotion")
Name: John
Operator: OR
Condition: When Gender = X or Y
Since Johns gender is X, it has met one of the condition X OR Y.
Result: Promotion OK
How to use IF in DATE Function?
Formula =IF(DAYS(2/16/2015, 2/16/2014) >= 365, "Senior", "Junior")
DAYS(2/16/2015, 2/16/2014) >= 365: In the first argument, the formula checks whether difference between those two days is greater than or equal to 365.