ISLOGICAL function
The ISLOGICAL function in Excel checks whether a value is a logical value, meaning it evaluates whether the value is either TRUE or FALSE. It returns TRUE if the value is a logical value, and FALSE otherwise.
Syntax:
ISLOGICAL(value)
Arguments:
- value: The value or expression you want to check. This could be a cell reference, a formula result, or a direct logical value (
TRUEorFALSE).
Example:
Example 1: Cell contains a logical value (TRUE)
- Data in A1:
TRUE - Formula:
=ISLOGICAL(A1) - Result:
TRUE(since A1 contains the logical valueTRUE).
Example 2: Cell contains a logical value (FALSE)
- Data in B1:
FALSE - Formula:
=ISLOGICAL(B1) - Result:
TRUE(since B1 contains the logical valueFALSE).
Example 3: Cell contains a number
- Data in C1:
5 - Formula:
=ISLOGICAL(C1) - Result:
FALSE(since C1 contains a number, not a logical value).
Example 4: Cell contains text
- Data in D1:
"Hello" - Formula:
=ISLOGICAL(D1) - Result:
FALSE(since D1 contains text, not a logical value).
Key Points:
- Logical Values: ISLOGICAL specifically looks for
TRUEorFALSEas the values. Any other type (numbers, text, errors, etc.) will returnFALSE. - Formulas: If a formula results in a logical value (
TRUEorFALSE), ISLOGICAL will returnTRUEfor the result of that formula. - Error Handling: If the
valueargument is an invalid reference, ISLOGICAL will return a#VALUE!error.
Use Cases:
- Conditional Logic: Use ISLOGICAL to perform actions only when a value is a logical value:
=IF(ISLOGICAL(A1), "Logical", "Not Logical") - Error Checking: Check whether a formula result is logically valid:
=IF(ISLOGICAL(AND(A1 > 5, B1 < 10)), "Logical Result", "Invalid Result")