When working with an Excel worksheet, you may notice that many cells contain formulas. To figure out the number of cells that are formulas, we will use the ISFORMULA function and the SUMPRODUCT function.
The ISFORMULA function is to check whether a cell is a formula or not, and the SUMPRODUCT function returns the product of numbers in an array.
Example: In the following database, the first name is in column A, the second name is in column B, and the results are in column C. For practice purposes, the results in column C include different types of values.
Formula: To get the number of cells that are formulas in column C
- The ISFORMULA function returns true if the cell is a formula, and false if not;
- The double hyphens are to convert true to 1, and false to 0.
- The SUMPRODUCT function returns the sum of the products of the new array.
In the example, two cells are formulas (C4 and C5). The formula is =C2+C3 in C4, and the formula is =C3+C4 in C5.
Notes: The SUMPRODUCT Function
The SUMPRODUCT function adds all the multiplication results for all arrays.
=SUMPRODUCT(array1, [array2], …)
– Array1 is required, the first array is to multiply and then add.
– Array2 is optional, the second array is to multiply and then add.