! Value ! Value

Value

Logical Logical

The value to negate.

Returns

Logical Logical

The negated value.

Negates the logical value, turning TRUE into FALSE and FALSE into TRUE. ! TRUE ! TRUE returns FALSE and ! FALSE ! FALSE returns TRUE.

Use ! , && and || in conjunction with IF to express logical conditions.

This formula returns 2 only if Value1 is 20 and Value2 is not 40, and 4 otherwise:

IF ((Value1 = 20) && ! (Value2 = 40), 2, 4)
IF ((Value1 = 20) && ! (Value2 = 40); 2; 4)

The formula can also be written using the AND and NOT functions:

IF ( AND (Value1 = 20, NOT (Value2 = 40)), 2, 4)
IF ( AND (Value1 = 20; NOT (Value2 = 40)); 2; 4)

&& is written between the values to test, instead of before them, which can make formulas easier to read.

To make the formula even easier to read, consider replacing the second = operator with either the <> operator or the != operator (which mean "not equal to"):

IF ((Value1 = 20) && (Value2 <> 40), 2, 4)
IF ((Value1 = 20) && (Value2 <> 40); 2; 4)

Examples

! FALSE
! FALSE

Returns TRUE.

! TRUE
! TRUE

Returns FALSE.

! { TRUE, FALSE, FALSE }
! { TRUE; FALSE; FALSE }

Returns { FALSE, TRUE, TRUE }{ FALSE; TRUE; TRUE }, as each individual array element is negated.

IF ((Value1 = 20) && ! (Value2 = 40), 2, 4)
IF ((Value1 = 20) && ! (Value2 = 40); 2; 4)

Returns 2 only if Value1 is 20 and Value2 is not 40, and 4 otherwise.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell