Difference makes the DIFFERENCE
Categorised Menu List
I believe no much introduction is required for IF statement, because, when we have to decide between two values, we use IF Condition or IF statement (Excel Usage).
eg: if you have a spreadsheet with total marks, and say for example, 50 marks is the cut-off mark, then we put a condition to check, if, that particular cell's value, is Greater than 50 or not, if it is greater than 50, the current cell content should be PASS else the current cell content should be FAIL. before, you continue, please consider to check the given examples, so that they may prepare you to learn the following content, in-fact it is good practice to study the questions first and then continue onto comprehension
When IF statement is used with Logical Operators, it is called Compound IF Statement.
Taking the same Marks example, Management want to concentrate more on the students who are on the border of pass mark of 50, so that a bit more concentration on these students will raise the pass percentage of the school, hence to get students whose marks are greater than 35 and less than 50,
then: Write the following statement, for students with marks between 35 and 50.
When an IF statement is used within another IF Statement, it is called Nested IF Statement. This can accommodate any number of conditions within another condition, including Logical operators.
Taking the same Marks example,
Now, the task is to Grade the students based on the marks in Col D (Total Marks). The classification would be as: students securing 75 marks and above are in Grade A, less than 25 marks are in Grade D, between 50 and 75 are with Grade B, between 25 and 50 are with Grade C.
As the situation demands, one can have any number of If statements required (Excel 2007 and later can contain up to 64 nesting levels, function can handle 30 arguments, which implies to testing 30 different conditions (in theory, I did not check)
The following examples can be used either in spreadsheet to check/validate the above given IF Statement, or can be used in programming...