If you are looking for a function in the Excel which gives you the desired answer when the condition is met or TRUE and returns another value when the condition is FALSE. The IF Function is such function which helps you in making the logical decisions. It gives you two results one your value is True and when your value is False.
Syntax of IF function:
IF(logical test,[value if true],[value if false])
Let us explore this function in Excel with the help of an example:
A teacher has the list of the marks of the students who appeared for the semester exam. If a student scores more than 35% then s/he passes the examination otherwise s/he needs to repeat the exam.
Can you help the teacher using the IF function in preparing the list of passed and the failed students?
Here is the list of the 20 students:
Based on the condition mentioned in the example, we need to use the IF function which gives the result "Pass" when student scores more 35% and "Fail" if the score is less than 35%. This can be done as follows:
=IF(C2>35%,” Pass”,” Fail”)
Explanation: The marks in the cell C2 are 55% which are greater than the set criteria of 35%. Therefore, the result is "Pass".
Similarly, for the next cell
=IF(C3>35%,” Pass”,” Fail”)
Explanation: The marks in the cell C3 are 25% which are less than the set criteria of 35%. Therefore, the result is "Fail".
You need not to write the condition every time in the cell, just drag the cell D3 till D21, the Remarks will be updated automatically.
The Final list of the students with remarks:
Let us take another example:
Mr. Smith is working in the XYZ ltd as a Financial Analyst. He is given the task to evaluate the feasibility of the two projects using the Internal Rate of Return (IRR) by the management. The management will approve the project if its IRR is greater than hurdle rate of 8% otherwise, the project is rejected.
The cash-flows of the two projects are as follows:
The negative value indicates the cash outflows while the positive values indicate the cash inflows.
After evaluating the IRR, he comes up with the following results:
The working of the IF function of the two projects are as follows:
Result: Yes, the project is feasible
Result: No, the project is not feasible
The user can use the IF function in many situations by setting the criteria as per the requirements. You can see in the above examples that it is a very powerful function which makes the decision making very easy.