IF()

 
 
  • IF() is a very commonly used function.

  • It comes under the Logical functions category.

USE of IF()

IF() could be used in situations like the following.

  1. If the Salary is less than 5000, DA is 40%; else it is 35%

  2. If Mark is less than 40%, Failed; else Passed.

IF function takes 3 parameters.

  • The first parameter is a Condition.

  • The second parameter is the value if Condition is TRUE.

  • The third parameter is the value if Condition is FALSE.

Given below are some conditions and their equivalent Excel representation.

 
 
If C2 is less than 40 "Failed"; else "Passed" IF(C2<40,"Failed","Passed")
 
If C2 is equal to or greater than 80 "High Mark"; else "Low Mark" IF(C2>=80,"High Mark","Low Mark")
 
  Conditions could be compounded to get AND logic

we can use nested IF() in such cases.

 
 
If c2 is greater than 4000   and   d2 is less than 6000  "Selected"; else "Rejected" IF(C2>4000(IF(D2<6000,"Selected","Rejected"),"Rejected")
If C2 is equal to or greater than 40 and

If D2 is equal to or greater than 40 and

If E2 is equal to or greater than 40  "Selected"; else "Rejected"

IF(C2>=40, IF(D2>=40( IF(E2>=40, "Selected", "Rejected"), "Rejected"), "Rejected")
If C2 is equal to or greater than 40 and

If D2 is equal to or greater than 40 and

If E2 is equal to or greater than 40 and

if average is greater than or equal
to 50
,  "Passed"; else "Failed"

 IF(C2>=40, IF(D2>=40, IF(E2>=40, IF( (C2+D2+E2)/3>=50,"Passed", "Failed") ,"Failed") ,"Failed") ,"Failed")
 
     
  Conditions could be compounded to get OR logic also.

We can use nested IF() in such cases also.

Try to write the IF function for the following

if c2 is greater than 40 or d2 is greater than 50 "Good"; else "Bad"

If you can write this correctly we will be glad that you have a clear understanding of IF(function)