# Excel IF() Function

Excel IF() Function: The IF() function in excel checks whether a condition is true or not and returns one value if the condition is TRUE and another value if it's FALSE.

Syntax

`if(Logical_Test, [value_if_true], [value_if_false])`

Parameter

Logical_Test (required)- This parameter represents the condition which you want to check (greater than, less than or equal to signs can be used for numbers). When you want to evaluate a condition based on text value, then use double quotes ('') with equal to signs.

value_if_true (optional)- This parameter represents the logical test value, and if it holds the value, then excel will return this value.

value_if_false (optional)- If the logical test does not hold, then excel will return this value.

Category

Logical

Return

The function returns one value if the condition is TRUE and another value if it's FALSE.

Example 1

Objective: Using IF formula to identify if a student has passed an exam or not

 Student Name Marks Pass or Fail Formula Mukta 80 Pass =IF(B2>=30,"Pass","Fail") Arvind 60 Pass =IF(B3>=30,"Pass","Fail") Jyotsna 29 Fail =IF(B4>=30,"Pass","Fail") Amar 11 Fail =IF(B5>=30,"Pass","Fail")

Example 2

Objective: Using the IF Function, check whether the student has passed or not. If the student has failed in 1 of the 2 subjects, then the student will be considered as Failed.

 Student Name Subject 1 Subject 2 Overall Result Formula Reeta PASS PASS PASS =IF(AND(B26="PASS",C26="PASS"),"PASS","FAIL") Sweta PASS FAIL FAIL =IF(AND(B27="PASS",C27="PASS"),"PASS","FAIL") Baani FAIL PASS FAIL =IF(AND(B28="PASS",C28="PASS"),"PASS","FAIL") Aditya PASS PASS PASS =IF(AND(B29="PASS",C29="PASS"),"PASS","FAIL")