Excel if statement is a decision making statement. It is defined as a function which checks that given condition is true or false. If it’s true it will execute true statement otherwise it will execute false statement. if formula in excel is:
If condition then true else false
Excel If statement:Excel If statement works same as programming language if statement.
We’ll be covering the following topics in this tutorial:
Syntax of Excel IF Statement
The syntax of If Function in Excel is as follows:
=IF (Logic_Test, Value_if_True, Value_if_False)
For example:
In IF(B5<40, “Fail”,”Pass”) statement explain that if value of Cell B5 is less than 40 than Rohit is fail otherwise he will pass. But Rohit’s marks is not less than 40 so result is pass.
*Nested if statement: Nested If used to test more than one condition at a particular time. In ‘nested if ‘ conditions are packed in one another to execute in a sequence manner. ‘Nested If’ in logical flow:
Syntax of Excel Nested IF Statement:
=IF(Logic_Test(1), Value_if_True,IF(Logic_Test(2), Value_if_True,IF (Logic_Test(3), Value_if_True, Value_if_False)))
In ‘Nested If’ system will execute Logic_Test(1) statement .Suppose to result is false then logic_Test(2) will executed. Now Condition is true value will be printed and nested if will more execute. To understand it more clearly let discuss an example.
In this example: We have Name, Marks and Grade column. We want to assign grade according to their marks in subject. We are assigning grade ’A’ who are getting marks more than 90.Grade ‘B’ who are getting less than 90 . Similarly, We are giving C,D and F grade.
*Condition in Formula Bar explaining that cell B4 value=40
If (40 is less than 60) ——Which is true
Then Grade ‘F’ is assigned.
*Lets talk about how nested if will work for cell B7 value=95
If (95 is less than 60) ——Which is False
Then (If (95 is less than 70) Again Condition is False
Then ((If (95 is less than 70))) Again Condition is False
Then (((If (95 is less than 90)))) Again Condition is False because 95>90
Grade ‘A’ is assigned to Loveleen.
Excel provides us Evaluate Formula to show that how statement will execute. Let us discuss example to assign the grade to ‘Rohit’ using above figure data. Evaluate function first check (70<60) which get false then click on evaluate.
Then second statement will checked by system. It is false then last one checked.