Panopia.com

Logical Functions

Calc spreadsheet file used in video: Right-click to download file

TRUE and FALSE

Many of the parameters used by the logical functions are Boolean values. There are 2 boolean values TRUE and FALSE, they evaluate to 1 and 0 respectively. and the numbers 1 and 0 can be used in place of TRUE and FALSE.

AND Function

The AND function takes Boolean values for it's parameters, if any of the parameters return FALSE then AND returns FALSE, otherwise it returns TRUE. In the following example AND tests whether the values in both A1 AND B1 are greater 2 , the value in A1 is less than 2 so AND returns FALSE:

In the next example the values in cells A1 and B1 are both greater than 2 so AND returns TRUE:

OR Function

The OR function like the AND function takes boolean parameters, if any of the parameters are true then OR returns TRUE, otherwise OR returns FALSE.
In the following example OR tests whether either of the values in cells A1 OR A2 are greater than 2. Neither one is greater than 2 so OR returns FALSE.

In the next example the value in Cell A1 is greater than 2, so OR returns TRUE.

IF Function

Often used along with the AND and OR functions the IF function tests whether a condition is true in it's first parameter, if true, it executes the 2nd parameter, otherwise it executes the 3rd parameter. If the 3rd parameter is left out, a zero is returned.
In the following example, the IF function is used to test if the value in cell A1 is 1 or true, if it is the 2nd parameter is executed and the text "One" is displayed in B1:

In the next example the Value in A1 is a zero so IF executes the 3rd parameter and displays the text "Zero" in cell B1:

NOT function

The NOT functions returns the inverse Boolean value of it's parameter value. For example NOT(1) returns FALSE and NOT(0) returns TRUE. Another example NOT(TRUE) returns FALSE and NOT(FALSE) returns TRUE.

XOR function

The XOR function takes up to 30 boolean arguments or an array of cells with boolean values. If an odd number of the arguments are TRUE XOR returns TRUE, Otherwise it returns FALSE. In the following example there are an even number (2) cells in the array which contain a 1 (TRUE) so XOR returns FALSE:

In the next example an odd number of cells (3) in the array contain 1 (TRUE) so XOR returns TRUE:

the FALSE function

Not surprisingly the FALSE function returns the boolean value FALSE. It takes no arguments:

©2021 Panopia.com