Test if a value is logical
=ISLOGICAL(value)
| Parameter | Description |
|---|---|
value |
The value to test as logical. |
The ISLOGICAL function returns TRUE if value is TRUE or FALSE:
=ISLOGICAL(TRUE) // returns TRUE
=ISLOGICAL(FALSE) // returns TRUE
If value is a formula, ISLOGICAL checks the result of the formula:
=ISLOGICAL(100>50) // returns TRUE
=ISLOGICAL(2+2) // returns FALSE
=ISLOGICAL(A1=B1) // returns TRUE
Note that 1 and 0 (zero) are not evaluated as TRUE and FALSE.
=ISLOGICAL(1) // returns FALSE
=ISLOGICAL(0) // returns FALSE
To count cells in a range that contain logicals, you can use the SUMPRODUCT function like this:
=SUMPRODUCT(--ISLOGICAL(range))