The IF function purpose in Microsoft Excel is to test for a condition if TRUE and another value if the condition is FALSE. The IF function is one of the most popular Excel functions and provides logical thinking in excel.
The IF function Syntax:
- logical test: The condition you want to test. It is required.
- value_if_true: Return the value you want; if the result of logical_test is TRUE, it is required.
- value_if_false: Return the value that you want if the result of logical_test is False. It is optional.
In this article, we will explain the IF Function in Excel.
Using the IF Function in Excel
In this example, we are going to use a table containing the test marks of students. We want to use the IF statement to determine who passes and who fails.
We are going to click the cell where we want the result. In this example, we are going to click the cell under the pass and fail column.
In the cell, type =IF(B5>50,” Fail”, “Pass”) in which B5>50 is a logical_ test, “Fail” is value_if_true and “Pass” is value_If_false. Press
Press Enter you will see your result.
You do not have to retype the value into other cells to get a result. You can click on the cell with the result, where you see a small box at the end of the cell, take your cursor and drag it down. You will see the result of the other cells.
The other option is to click on the Formulas tab.
In the Function Library group, click the Logical tool. The Logical tool adds a Logical Function to your library. In the drop-down menu, select the IF function. A Function Argument dialog box will appear.
In the function Argument Dialog Box, type B5<54 in the logical_test entry box, then type “Fail” in the value_if_true entry box and Type “Pass” in the value_If_false entry box. Then press OK.
You will see the result.
- Tags: Excel