In Excel you can make use of IF function to test a condition and return the value based on whether the condition was met. The syntax if IF function is
IF(logical_test, [value_if_true], [value_if_false])
The function has following arguments
logical_test (Mandatory): It can be any value or expression which can be evaluated to TRUE or FALSE. For example the value in cell C2 > 40 is an expression. If the value of cell C2 is 44, IF function will return TRUE otherwise it will return FALSE.
value_if_true (Optional): This can be the value which you wish the IF function to return when logical_test evaluates to TRUE. If not specified, the IF function returns a value 0.
value_if_false (Optional):This can be the value which you wish the IF function to return when logical_test evaluates to FALSE. If not specified, the IF function returns a value 0.
Though the use of IF function can be made in endless manners, I am taking a simple example for demonstration. Assume you have the marks in one column and you wish to store the result in form of PASS or FAILED depending on the marks in another column. You can use the 'IF' function as follows.
In the above example, we used the formula =IF(C2>=40,"PASS","FAILED") to evaluate whether the student has scored passing marks or not. As you can see, the criteria for passing is that student has to score 40 or above. Therefor the value returned is "PASS" as the expression has resulted in TRUE for C2. Now, if the marks are below 40, the IF function will return FAILED. In the below snapshot, as the value of cell C3 is 33, the formula =IF(C3>=40,"PASS","FAILED") will return "FAILED"
You may also want to refer the below tutorial to understand more about IF function
Using Nested 'IF' function in Excel
Please feel free to drop any feedback or ask any questions.
Using Nested 'IF' function in Excel
Please feel free to drop any feedback or ask any questions.
0 comments:
Post a Comment