In the post, let’s learn about the conditional statements in Excel and how you can use IF Statement in the formulas in Excel worksheets.
What is IF Statement in Excel and its uses?
The IF statement is a decision-making statement that guides a program to make decisions based on specified criteria. It executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.
The following are the steps to use IF Statement in excel:
- First, prepare an excel sheet with the required details in it.
- To check the condition, you can use the IF Function formula:
Nested If Statement
- A “Nested IF” refers to a formula where at least one IF function is nested inside another to test for more conditions and return more possible results.
- You can use the following formula: =IF(B2>95,”A”,IF(B2>90,”B”,IF(B2>85,”C”,IF(B2>80,”D”)))) or =IF(B5>95,”A”,IF(B5>90,”B”,IF(B5>85,”C”,”D”))).
IF Statement with AND & OR
- The AND Function returns a TRUE value if all conditions are true and returns a FALSE value if any of the conditions are false. The AND (&&) operations of two inputs A and B can be written as “AB”.
- To use the IF Function in combination with the And function, you can follow the given formula: =IF(AND(B2>=60,C2>=90),”Pass”,”Fail”).
- The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false. The OR (||) value of two inputs A and B can also be written as “A+B”.
- To use the IF Function in combination with the OR function, you can follow the given formula: =IF(OR(B2>=60,C2>=60),”Pass”,”Fail”)