Documentation/Calc Functions/TRUE

    From The Document Foundation Wiki
    Other languages:


    Function name:

    TRUE

    Category:

    Logical

    Summary:

    Outputs the logical value TRUE.

    Syntax:

    TRUE()

    Returns:

    Returns the logical value TRUE.

    Arguments:

    None.

    Additional details:

    In many cases the TRUE function may not be needed in your spreadsheet because you can enter the word "TRUE" (case-insensitive) directly into a cell or formula, and Calc interprets this as the logical value TRUE.

    The recognition of the plain word "TRUE" (as equivalent to the function) depends on the locale setting at Tools Options ▸ Language Settings ▸ Languages ▸ Locale setting.


    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
    =TRUE() Return the logical value TRUE. TRUE
    =NOT(TRUE()) Return the logical value FALSE. FALSE

    Related LibreOffice functions:

    AND

    FALSE

    IF

    IFERROR

    IFNA

    IFS

    ISERROR

    NOT

    OR

    SWITCH

    XOR

    ODF standard:

    Section 6.15.9, part 2

    Related (or similar) Excel functions:

    TRUE