Excel IF Function is another very useful and a lot used logical excel formula which checks for the fulfillment of condition in excel. In this tutorial, we would cover the following points on the IF formula in Excel:
- What is the use of IF formula in Excel
- Syntax and Argument
- Using the IF function with a simple example in Excel
- Some interesting facts and points about this function
- Using Nested IF in Excel
- Other practical use of the excel IF formula
Purpose of IF Function in Excel
As mentioned in the introduction, the =IF() formula is a logical excel function that is used to check a specified condition in Excel and return a particular text/value based on the condition.
- If the result of the check condition is TRUE, then excel would return a particular text/value.
- And if the result of check condition is FALSE, then excel returns another specified text/value.
Syntax and Arguments of IF Function
=IF(logical_test, [value_if_true], [value_if_false])
There are three basic arguments of the excel IF formula:
- logical_test – In this argument, you need to specify the condition to check for TRUE and FALSE. You could either enter the condition manually or as a reference to some other cell/formula.
- [value_if_true] – This is an optional argument. Excel will return the text/value you specify in this argument, if the logical_test is TRUE.
- [value_if_false] – This is also an optional argument. Excel will return the text/value you specify in this argument, if the logical_test is FALSE.
Simple Example of Using IF Function in Excel
Let us take one very simple example in excel to understand how the IF formula works in excel.
Suppose in order to pass an examination, a student needs a minimum of 40 marks in a subject. the below image shows the marks obtained by different students in a subject.
In the above example, in order to determine if the student has passed or failed the examination, simply use the following formula:
Explanation of the above IF function – The formula first checks the test condition (i.e. if marks in cell B2 is greater than equal to 40). If the condition matches, then excel returns the text ‘Pass’, otherwise it returns ‘Fail’.
In the above example, we have used the logical operator ‘greater than equal to’ to check for the minimum marks of 40. Below is the list of other excel logical operators-
Now, when you have some basic understanding of how the Excel IF function works, let us learn some important facts and points about the IF formula.
Do Not Miss These Points
- The second and third arguments of the IF function (i.e. value_if_true and value_if_false) are optional arguments. Therefore, if you do not specify anything in value_if_true, then excel would return 0 if the IF condition is met. Similarly, if you do not enter anything in value_if_false, then excel would return 0 if the IF condition is not met.
- The IF function argument can also accept another IF function with it to check for more complex conditions in excel. This is called a nested IF function or nested IF formula.
- You can embed a maximum of 64 IF formula inside a single IF function.
What is Nested IF Function and How to Use with Example
When you check an IF condition inside another IF condition then it is called as nested IF. This means that you can create a formula or function which checks multiple IF conditions in a sequence.
Let us take one simple example how the multiple IF formula works.
For example, if a student gets less than 40 marks, then excel should mention the text ‘Fail’. Otherwise, if marks are greater than equal to 40, then excel should again check if marks are greater than 80. If yes, then it should return ‘Rank Holder’, else simply ‘Pass’.
Note that here excel checks for the condition fulfilment in a sequence.
Other Practical Example of IF Function in Excel
The IF excel formula is very useful in finding the commission of the salesperson based on the target achievement or sales.
There are many other such practical areas where the IF function can be used in excel. In fact, this is the most used excel function.