# Logic

• AND logical conjunction
• FALSE the value FALSE
• IF conditional expression
• IFERROR test for error
• IFNA test for #N/A error
• IFS multi-branch conditional
• NOT logical negation
• OR logical disjunction
• SWITCH multi-branch selector
• TRUE the value TRUE
• XOR logical exclusive disjunction

## AND

AND logical conjunction

### Synopsis

`AND(b0,b1,…)`

### Arguments

b0: logical value

b1: logical value

### Description

AND calculates the logical conjunction of its arguments b0,b1,...

### Note

If an argument is numerical, zero is considered FALSE and anything else TRUE. Strings and empty values are ignored. If no logical values are provided, then the error #VALUE! is returned. This function is strict: if any argument is an error, the result will be the first such error.

### Microsoft Excel Compatibility

This function is Excel compatible.

OR, NOT, IF.

## FALSE

FALSE the value FALSE

### Synopsis

`FALSE()`

### Description

FALSE returns the value FALSE.

### Microsoft Excel Compatibility

This function is Excel compatible.

TRUE, IF.

## IF

IF conditional expression

### Synopsis

`IF(cond,trueval,falseval)`

### Arguments

cond: condition

trueval: value to use if condition is true

falseval: value to use if condition is false

### Description

This function first evaluates the condition. If the result is true, it will then evaluate and return the second argument. Otherwise, it will evaluate and return the last argument.

AND, OR, XOR, NOT, IFERROR.

## IFERROR

IFERROR test for error

### Synopsis

`IFERROR(x,y)`

### Arguments

x: value to test for error

y: alternate value

### Description

This function returns the first value, unless that is an error, in which case it returns the second.

## IFNA

IFNA test for #N/A error

### Synopsis

`IFNA(x,y)`

### Arguments

x: value to test for #N/A error

y: alternate value

### Description

This function returns the first value, unless that is #N/A, in which case it returns the second.

## IFS

IFS multi-branch conditional

### Synopsis

`IFS(cond1,value1,cond2,value2,…)`

### Arguments

cond1: condition

value1: value if condition1 is true

cond2: condition

value2: value if condition2 is true

### Description

This function returns the value after the first true conditional. If no conditional is true, #VALUE! is returned.

IF.

## NOT

NOT logical negation

`NOT(b)`

b: logical value

### Description

NOT calculates the logical negation of its argument.

### Note

If the argument is numerical, zero is considered FALSE and anything else TRUE. Strings and empty values are ignored.

### Microsoft Excel Compatibility

This function is Excel compatible.

AND, OR, IF.

## OR

OR logical disjunction

### Synopsis

`OR(b0,b1,…)`

### Arguments

b0: logical value

b1: logical value

### Description

OR calculates the logical disjunction of its arguments b0,b1,...

### Note

If an argument is numerical, zero is considered FALSE and anything else TRUE. Strings and empty values are ignored. If no logical values are provided, then the error #VALUE! is returned. This function is strict: if any argument is an error, the result will be the first such error.

### Microsoft Excel Compatibility

This function is Excel compatible.

AND, XOR, NOT, IF.

## SWITCH

SWITCH multi-branch selector

### Synopsis

`SWITCH(ref,choice1,value1,choice2,value2,…)`

### Arguments

ref: value

choice1: first choice value

value1: first result value

choice2: second choice value

value2: second result value

### Description

This function compares the reference value, ref, against the choice values, choice1 etc., and returns the corresponding result value when it finds a match. The choices may be followed by a default value to use. If there are no choices that match and no default value, #N/A is return.

IF, IFS.

## TRUE

TRUE the value TRUE

`TRUE()`

### Description

TRUE returns the value TRUE.

### Microsoft Excel Compatibility

This function is Excel compatible.

FALSE, IF.

## XOR

XOR logical exclusive disjunction

### Synopsis

`XOR(b0,b1,…)`

### Arguments

b0: logical value

b1: logical value

### Description

XOR calculates the logical exclusive disjunction of its arguments b0,b1,...

### Note

If an argument is numerical, zero is considered FALSE and anything else TRUE. Strings and empty values are ignored. If no logical values are provided, then the error #VALUE! is returned. This function is strict: if any argument is an error, the result will be the first such error.