# Logical Functions

This category contains the Logical functions.

### Handling non-logical arguments in logical functions

• Zero (0) is equivalent to FALSE and all other numbers are equivalent to TRUE.

• Empty cells and text in cells are ignored.

• A #VALUE error is raised if all arguments are ignored.

• A #VALUE error is raised if one argument is direct text (not text in a cell).

• Errors as argument lead to an error.

За да пристапите до оваа наредба...

Insert - Function - Category Logical

## ISNA

Returns TRUE if a cell contains the #N/A (value not available) error value.

If an error occurs, the function returns FALSE.

#### Syntax

ISNA(value)

Value is the value or expression to be tested.

#### Example

ISNA(D3) returns FALSE as a result.

## ISERROR

Returns the value if the cell does not contains an error value, or the alternative value if it does. This function is available since LibreOffice 4.0.

#### Syntax

IFERROR(Value; Alternate_value)

Value is the value or expression to be returned if it is not equal or results in an error.

Alternate_value is the value or expression to be returned if the expression or value of Value is equal or results in an error.

#### Example

ISERROR(C8) returns FALSE.

ISERROR(C8) returns FALSE.

### IFS

IFS is a multiple IF-function.

### SWITCH

SWITCH compares expression with value1 to valuen and returns the result belonging to the first value that equals expression. If there is no match and default_result is given, that will be returned.

## AND

Returns TRUE if all arguments are TRUE. If one of the elements is FALSE, this function returns the FALSE value.

The arguments are either logical expressions themselves (TRUE, 1<5, 2+3=7, B8<10) that return logical values, or arrays (A1:C3) containing logical values.

#### Syntax

AND(Logical 1 [; Logical 2 [; … [; Logical 255]]])

Logical 1, Logical 2, … , Logical 255 are boolean values, references to cells or to cell ranges of logical values.

#### Example

The logical values of entries 12<13; 14>12, and 7<6 are to be checked:

AND(12<13; 14>12; 7<6) returns FALSE.

AND (FALSE;TRUE) returns FALSE.

## OR

Returns TRUE if at least one argument is TRUE. This function returns the value FALSE, if all the arguments have the logical value FALSE.

The arguments are either logical expressions themselves (TRUE, 1<5, 2+3=7, B8<10) that return logical values, or arrays (A1:C3) containing logical values.

#### Syntax

OR(Logical 1 [; Logical 2 [; … [; Logical 255]]])

Logical 1, Logical 2, … , Logical 255 are boolean values, references to cells or to cell ranges of logical values.

#### Example

The logical values of entries 12<11; 13>22, and 45=45 are to be checked.

OR(12<11; 13>22; 45=45) returns TRUE.

OR(FALSE;TRUE) returns TRUE.

## FALSE

Returns the logical value FALSE. The FALSE() function does not require any arguments, and always returns the logical value FALSE.

FALSE()

#### Example

If A=TRUE and B=FALSE the following examples appear:

=AND(A;B) returns FALSE

## XOR

Returns true if an odd number of arguments evaluates to TRUE.

The arguments are either logical expressions themselves (TRUE, 1<5, 2+3=7, B8<10) that return logical values, or arrays (A1:C3) containing logical values. This function is available since LibreOffice 4.0.

#### Syntax

XOR(Logical 1 [; Logical 2 [; … [; Logical 255]]])

Logical 1, Logical 2, … , Logical 255 are boolean values, references to cells or to cell ranges of logical values.

#### Example

AND (FALSE;TRUE) returns FALSE.

OR(FALSE;TRUE) returns TRUE.

OR(FALSE;TRUE) returns TRUE.

## NOT

Reverses the logical value.

#### Syntax

NOT(Logical value)

Logical Value is any value to be reversed.

#### Example

NOT(A). A=TRUE reverses to A=FALSE.

## IF

Specifies a logical test to be performed.

#### Syntax

IF(Test [; ThenValue [; OtherwiseValue]])

Test is any value or expression that can be TRUE or FALSE.

Then_value (optional) is the value that is returned if the logical test is TRUE.

Otherwise_value (optional) is the value that is returned if the logical test is FALSE.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

#### Example

IF(A1>5;100;"too small") If the value in A1 is higher than 5, the value 100 is entered in the current cell; otherwise, too small is entered in text format.

## TRUE

The logical value is set to TRUE. The TRUE() function does not require any arguments, and always returns the logical value TRUE.

TRUE()

#### Example

If A=TRUE and B=FALSE the following examples appear:

=AND(A;B) returns FALSE

=OR(A;B) returns TRUE

=NOT(AND(A;B)) returns TRUE