Purpose

Return value

Syntax

=ISFORMULA(reference)
  • reference - Reference to cell or cell range.

Using the ISFORMULA function

The ISFORMULA function returns TRUE if a cell contains a formula, and FALSE if not. When a cell contains a formula ISFORMULA will return TRUE regardless of the formula’s output or error conditions. The ISFORMULA takes one argument , reference , which must be a cell reference.

Examples

If cell A1 contains the formula =2+2, the ISFORMULA function returns TRUE:

=ISFORMULA(A1) // returns TRUE

If cell A1 contains the text “apple”, the ISFORMULA function returns FALSE:

=ISFORMULA(A1) // returns FALSE

Count formulas

To count cells in a range that contain formulas, you can use the SUMPRODUCT function like this:

=SUMPRODUCT(--ISFORMULA(range))

The double negative coerces the TRUE and FALSE results from ISFORMULA into 1s and 0s and SUMPRODUCT returns the sum.

Notes

  • You can temporarily display all formulas in a worksheet with a keyboard shortcut .
  • To extract and display a formula as text, use the FORMULATEXT function .

Purpose

Return value

Syntax

=ISLOGICAL(value)
  • value - The value to test as logical.

Using the ISLOGICAL function

The ISLOGICAL function returns TRUE when a cell contains the logical values TRUE or FALSE, and returns FALSE for cells that contain any other value, including empty cells.

The ISLOGICAL function takes one argument, value , which can be a cell reference, a formula, or a hardcoded value. When value is TRUE or FALSE, the ISLOGICAL function will return TRUE. If value is any other value, ISLOGICAL will return FALSE.

Examples

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

Count logicals

To count cells in a range that contain logicals, you can use the SUMPRODUCT function like this:

=SUMPRODUCT(--ISLOGICAL(range))

The double negative coerces the TRUE and FALSE results from ISLOGICAL into 1s and 0s and SUMPRODUCT sums the result.

Notes

  • Only the logical values TRUE and FALSE return TRUE