Conditional logic is used frequently in spreadsheets.
This concept states that if something is true, then something else will happen.
As far as a spreadsheet is concern, a cell is often tested for a certain value and:
- If this is the value, one thing will happen
- If it is not the value, something different will happen
The standard operating logic symbols are used:
| = | Equal to |
| > | Greater than |
| >= | Greater than or equal to |
| < | Less than |
| <= | Less than or equal to |
| <> | Not equal to |
The main logical function used in spreadsheets is the =IF function
The =IF function will return one value if the specified condition is true, and another value if the condition is false.
For example, in a spreadsheet of exam marks and the pass mark is 70%, if the candidate gets 72% they will pass, and if they get 60% they will fail.
The =IF function is made up as follows:
=IF(logical test, value if true, value if false)
This can be split into three parts:
| Logical Test | This can be any value or expression which can be evaluated as true or false. |
| Value if true | This is the value which will be displayed by the function if the condition is true. |
| Value if false | This is the value which will be displayed by the function if the condition is false. |
For example, the following spreadsheet will be used to work out whether a student has passed their maths exam.
