QYn3w‖

HZKH9‖Logical Functions

xK9mn‖This category contains the Logical functions.

ADKTB‖Handling non-logical arguments in logical functions

To access this command...

Insert - Function - Category Logical


Eu8CA‖ISNA

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

29huD‖If an error occurs, the function returns FALSE.

GSbiK‖Syntax

Atn9F‖ISNA(Value)

UfAek‖Value is the value or expression to be tested.

MiUAf‖Example

UyzSk‖=ISNA(D3) returns FALSE as a result.

DWG3v‖IFERROR

AXmEw‖Returns the value if the cell does not contain an error value, or the alternative value if it does.

tip

VJxhP‖This function is available since LibreOfficeDev 4.0.


GSbiK‖Syntax

LREwJ‖IFERROR(Value; Alternate_value)

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

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

MiUAf‖Example

P5A9v‖=IFERROR(C8;C9) where cell C8 contains =1/0 returns the value of C9, because 1/0 is an error.

GCAeY‖=IFERROR(C8;C9) where cell C8 contains 13 returns 13, the value of C8, which is not an error.

kRbQi‖IFS

iANFF‖IFS is a multiple IF-function.

F6kQd‖SWITCH

vaCEi‖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.

CkoPa‖

Buy5k‖OR

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

qjqEk‖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.

GSbiK‖Syntax

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

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

note

rBWwb‖This function ignores any text or empty cell within a data range. If you suspect wrong results from this function, look for text in the data ranges. To highlight text contents in a data range, use the value highlighting feature.


MiUAf‖Example

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

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

b9b8x‖ =OR(FALSE();TRUE()) returns TRUE.

note

CQGT5‖The array formula {=OR(B1:B10;C1:C10)} yields a one-dimensional value of FALSE when all components of B1:B10 and C1:C10 are FALSE. The array expression above does not produce the logical OR per element, and thus does not produce an array of logical values. To compute a logical OR of arrays per element use the + operator in array context. In the example, enter {=B1:B10+C1:C10}.


FJajE‖

FVAzd‖IF

uai2u‖Specifies a logical test to be performed.

GSbiK‖Syntax

3CRyJ‖IF(Test [; [ThenValue] [; [OtherwiseValue]]])

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

bwFgW‖ ThenValue (optional) is the value that is returned if the logical test is TRUE.

DSBGV‖ OtherwiseValue (optional) is the value that is returned if the logical test is FALSE.

In the LibreOfficeDev 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.

MiUAf‖Example

6jCGx‖ =IF(A1>5;100;"too small") If the value in A1 is greater than 5, the value 100 is returned; otherwise, the text too small is returned.

itBPN‖ =IF(A1>5;;"too small") If the value in A1 is greater than 5, the value 0 is returned because empty parameters are considered to be 0; otherwise, the text too small is returned.

Q6yTs‖=IF(A1>5;100;) If the value in A1 is less than 5, the value 0 is returned because the empty OtherwiseValue is interpreted as 0; otherwise 100 is returned.

p3aJ9‖

GeEjD‖NOT

6eRtd‖Complements (inverts) a logical value.

GSbiK‖Syntax

CDMvz‖NOT(LogicalValue)

tGRva‖ LogicalValue is any value to be complemented.

MiUAf‖Example

CxaVa‖ =NOT(A). If A=TRUE then NOT(A) will evaluate FALSE.

zBqte‖

dGWkh‖FALSE

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

GSbiK‖Syntax

NGqhh‖FALSE()

MiUAf‖Example

WQSG6‖ =FALSE() returns FALSE

FZTDh‖ =NOT(FALSE()) returns TRUE

m3wRk‖

dRCa6‖TRUE

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

GSbiK‖Syntax

Ag9Yb‖TRUE()

MiUAf‖Example

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

S2m7R‖ =AND(A;B) returns FALSE

EGC3y‖ =OR(A;B) returns TRUE

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

AJT6C‖

nhmzk‖XOR

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

GG7sC‖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.

tip

VJxhP‖This function is available since LibreOfficeDev 4.0.


GSbiK‖Syntax

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

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

MiUAf‖Example

nmHwu‖ =XOR(TRUE();TRUE()) returns FALSE

MM3ma‖ =XOR(TRUE();TRUE();TRUE()) returns TRUE

D87Zv‖ =XOR(FALSE();TRUE()) returns TRUE

oiCrX‖

yHFyv‖AND

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

uDotD‖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.

GSbiK‖Syntax

7ALjG‖AND(Logical 1 [; Logical 2 [; … [; Logical 255]]])

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

note

rBWwb‖This function ignores any text or empty cell within a data range. If you suspect wrong results from this function, look for text in the data ranges. To highlight text contents in a data range, use the value highlighting feature.


MiUAf‖Example

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

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

nsBfV‖ =AND(FALSE();TRUE()) returns FALSE.

note

XUnCE‖The array formula {=AND(B1:B10;C1:C10)} yields a one-dimensional value of TRUE when all components of B1:B10 and C1:C10 are TRUE. The array expression above does not produce the logical AND per element, and thus does not produce an array of logical values. To compute a logical AND of arrays per element use the * operator in array context. In the example, enter {=B1:B10*C1:C10}.