Logical functions

    Some of these functions evaluate Boolean expressions as true or false conditions. Others evaluate arguments that aren't actual Boolean expressions, such as text or arithmetic operations that do not make a true or false statement.

    Logical functions take numbers, arithmetic operations, equations, cell references, and field names as arguments. Logical functions generally interpret nonzero whole or real numbers as true and a 0 argument as false, unless the purpose of the function is to invert the condition of the argument (for example, the NOT function). Some of the functions evaluate text arguments as false, while others return an error.

      AND
    IF
    ISBLANK
    ISERROR
    ISLOGICAL
    ISNA (Is Not Available)
    ISNUMBER
    ISTEXT
    NOT
    OR

AND

    Evaluates the argument or arguments and returns TRUE if all arguments are true. If one argument is false, the AND function returns FALSE. If the argument is a number or arithmetic operation (such as 1+1) rather than an equation (such as 1+1 = 2), then 0 equals FALSE and all other values equal TRUE.

    Format: =AND(logical1,logical2,...)

    Argument:
    logical: a numeric expression

    Example: =AND(B1) returns TRUE, meaning that cell B1 contains a nonzero number.

Top

IF

    Evaluates an expression and returns one of two possible results.

    Format: =IF(logical,true value,false value)

    Arguments:
    logical: an expression that is evaluated as TRUE or FALSE. A numeric expression that is evaluated as 0 is considered FALSE; all nonzero results are considered TRUE.
    true value: a value or an expression that returns a value. Can contain calculations that return a result or functions such as BEEP, ALERT, or MACRO.
    false value: a value or an expression that returns a value. Can contain calculations that return a result or functions such as BEEP, ALERT, or MACRO.

    Example: =IF(D7>=65,"Pass","Fail") returns "Pass" if cell D7 contains 65 or more. If cell D7 contains 64 or less, this formula returns "Fail."

    =IF(D7>100,ALERT("Limit exceeded!"),D7) displays a message box with the text "Limit exceeded!" if the value in cell D7 is 101 or greater. If the value of cell D7 is 100 or less, this formula returns the value in cell D7.

Top

ISBLANK

    Determines whether an expression is blank (TRUE) or contains a number or text (FALSE).

    Format: =ISBLANK(value)

    Argument:
    value: a text or numeric expression

    Example: =ISBLANK("test") returns FALSE.

Top

ISERROR

    Determines whether an error has occurred in evaluating an expression.

    Format: =ISERROR(value,error type)

    Arguments:
    value: a text or numeric expression
    error type (optional): any of the following predefined errors:
    #N/A!: not available
    #DIV/0!: divide by zero
    #VALUE!: incorrect value
    #NUM!: incorrect number
    #REF!: reference to incorrect cell
    #ARG!: incorrect number of arguments or incorrect argument type
    #USER!: user-defined error
    #DATE!: incorrect date
    #TIME!: incorrect time
    #ERROR!: not a true error

    Example: If cell K7 contains text or a valid number, =ISERROR(K7) returns FALSE, meaning that no error was encountered when evaluating cell K7.

Top

ISLOGICAL

    Determines whether the argument contains a Boolean expression (whether the value, operation, or equation in the argument can be evaluated as either true or false). Returns TRUE (1) if the expression is Boolean and FALSE (0) if it is not.

    Format: =ISLOGICAL(value)

    Argument:
    value: a text, number, cell reference, or function that is evaluated as a Boolean value

    Example: =ISLOGICAL(1<2) returns TRUE.

Top

ISNA (Is Not Available)

    Tests the contents of a cell for the #N/A! error condition and returns TRUE if it finds it. This function is useful for checking the results of formulas that contain the MATCH, LOOKUP, VLOOKUP, or HLOOKUP functions.

    Note: The ISNA function is not available in databases.

    Format: =ISNA(value)

    Argument:
    value: any text, number, cell reference, or function

    Example: =ISNA(TRUE) returns FALSE because TRUE is a Boolean expression, not an #N/A! error.

Top

ISNUMBER

    Determines whether an expression is a number (TRUE) or not (FALSE).

    Format: =ISNUMBER(value)

    Argument:
    value: any text, number, cell reference, or function that is evaluated as a number (not text or blank)

    Example: =ISNUMBER("a") returns FALSE.

Top

ISTEXT

    Determines whether an expression is text (TRUE) or not (FALSE).

    Format: =ISTEXT(value)

    Argument:
    value: any text, number, cell reference, or function that is evaluated as text (not a number)

    Example: =ISTEXT("hello") returns TRUE.

Top

NOT

    Gives the opposite result of a logical value or expression. Except for TRUE and FALSE, this function does not interpret text.

    Format: =NOT(logical)

    Argument:
    logical: a numeric value that is evaluated as a Boolean expression. If the argument is a number or arithmetic operation (such as 1+1) rather than an equation (such as 1+1=2), then 0 equals TRUE and all other values equal FALSE.

    Example: =NOT(0) returns TRUE because 0 evaluates as FALSE.

Top

OR

    Evaluates the argument or arguments and returns TRUE if any argument is true and FALSE if all arguments are false. If the argument is a number or arithmetic operation (such as 1+1) rather than an equation (such as 1+1=2), then 0 equals FALSE and all other values equal TRUE.

    Format: =OR(logical1,logical2,...)

    Argument:
    logical: a numeric expression

    Example: =OR(A1+A2<100,B1+B2<100) returns FALSE if the sums of the indicated cells are both greater than 100, and TRUE if at least one of the sums is less than 100. =OR(5,0,6) returns TRUE because at least one argument is not zero.

Top

Related topic

 


Table of contents | Index