Documentation/Calc Functions/NOT

    From The Document Foundation Wiki
    Other languages:


    Function name:

    NOT

    Category:

    Logical

    Summary:

    Determines the logical complement or negation of a Boolean value, reversing true values to false and false values to true.

    Syntax:

    NOT(Logical Value)

    Returns:

    Returns either TRUE (1) or FALSE (0), giving the logical complement of the supplied logical value.

    Arguments:

    Logical Value is an expression, or a reference to a cell containing an expression, that can be evaluated to a logical value TRUE or FALSE. If Logical Value is evaluated to a number instead of a logical value, then the value 0 (zero) is treated as FALSE, while any non-zero numeric value is treated as TRUE.

    • If Logical Value cannot be evaluated as a logical value, then NOT reports a #VALUE! error.

    Additional details:

    General information about Calc's logical functions

    Note pin.svg

    Note:
    For convenience, the information in this subsection is repeated on all pages describing Calc’s logical functions.

    Calc uses the numbers 0 (FALSE) and 1 (TRUE) to represent logical values. For example, enter 1 in a cell that has the default general number format. Then select Format ▸ Cells on the Menu bar to display the Format Cells dialog, select the Boolean Value option in the Category area of the Numbers tab, and click the OK button. Notice that the number 1 is now displayed as TRUE. To revert to displaying the number 1, repeat the process but select Number instead of Boolean Value.

    To enter a logical value into a cell, simply type either TRUE or FALSE (case-insensitive) into the cell. Calc will recognize the logical value, display it in uppercase letters, and change the cell's format to that appropriate to Boolean values.

    Calc functions that produce a logical result return a number, either 0 or 1. In the case of a formula that simply calls such a logical function and is in a cell that has the default general number format, the cell is switched to the Boolean value format and the returned value is displayed as FALSE or TRUE. For example =TRUE() returns the value 1, which is displayed as TRUE; if you then change the format to a numerical format, it is displayed as the number 1.

    Calc functions that test for a logical result always evaluate the expression to be tested and check if it is equal to 0. The value 0 is taken as FALSE and any other value is taken as TRUE. For example, =NOT(0) returns TRUE and =NOT(57.89) returns FALSE.

    In contrast to Calc, Microsoft Excel has a separate type for logical values - they are not numbers but are sometimes converted to numbers. Take care therefore if you need compatibility.

    Examples:

    Formula Description Returns
    =NOT(TRUE()) Negate TRUE(). FALSE
    =NOT(D1)

    where cell D1 contains the number 234.567.

    Logical complement of a non-zero numeric value. FALSE
    =NOT(1 > 2) The expression evaluated is FALSE. TRUE
    =1*NOT(NOT(D1))

    where cell D1 contains a non-zero numeric value.

    The function applied twice "flattens" numeric non-zero values (whether positive or negative) to "1". 1

    Related LibreOffice functions:

    AND

    FALSE

    IF

    IFERROR

    IFNA

    IFS

    OR

    SWITCH

    TRUE

    XOR

    ODF standard:

    Section 6.15.7, part 2

    Related (or similar) Excel functions:

    NOT