In this article we will learn how we can use IF condition.
IF condition allows us to use multiple conditions in a cell. This function helps us to create some flexibility in the function in Microsoft Excel 2010 & Microsoft Excel 2013.
This function is very useful when we want to check multiple conditions. Excel allows to us 64 conditions which can be checked in a cell.
Syntax of “IF” function: =if (logical test, [value_if_true], [value_if_false])
Example:Cell A2 and A3 contains the number 3 and 5. I want to if the number is 3 then formula display “Yes” otherwise “No”.
Let’s take an example and understand how and where we can use If function in Microsoft Excel.
We are having Students score data in range A12:B23. Column A contains Students Name, column B contains Scores. We have require Grade on some criteria’s which is, if any student scored equals to or less than “40” grade should be “D”, and if score is equals to or less than “60” grade should be “C”, and if score is equals to or less than “80” grade should be “B”, and if score is equals to or less than “100” grade should be “A.
We have to use here IF function along with AND Function because there is more than 2 criteria.
- Select the cell C13 and write the formula.
- =IF(B13<=40,”D”,IF(AND(B13>40,B13<=60),”C”,IF(AND(B13>60,B13<=80),”B”,IF(B13<=100,”A”)))), press enter.
- The function will return the grade as per the criteria.
- To return the grade for all the students copy the same formula by pressing the key Ctrl+C and paste into the range C14:C23 by pressing the key Ctrl+V.
This is all about the IF function in Microsoft Excel. We used this function when we wanted results as per our criteria, through this function we can put our requirement in Excel’s language.