Page 296 - Excel 2007 Bible
P. 296
19_044039 ch14.qxp 11/21/06 11:06 AM Page 253
Counting nonblank cells
To count nonblank cells, use the COUNTA function. The following formula uses the COUNTA function to
return the number of nonblank cells in a range named Data:
=COUNTA(Data)
The COUNTA function counts cells that contain values, text, or logical values (TRUE or FALSE).
If a cell contains a formula that returns an empty string, that cell is included in the count
NOTE
NOTE
returned by COUNTA, even though the cell appears to be blank.
Counting numeric cells
To count only the numeric cells in a range, use the following formula (which assumes the range is named
Data):
=COUNT(Data)
Cells that contain a date or a time are considered to be numeric cells. Cells that contain a logical value
(TRUE or FALSE) aren’t considered to be numeric cells.
Counting text cells Creating Formulas That Count and Sum 14
To count the number of text cells in a range, you need to use an array formula. The array formula that fol-
lows returns the number of text cells in a range named Data:
{=SUM(IF(ISTEXT(Data),1))}
Counting nontext cells
The following array formula uses Excel’s ISNONTEXT function, which returns TRUE if its argument refers to
any nontext cell (including a blank cell). This formula returns the count of the number of cells not contain-
ing text (including blank cells):
{=SUM(IF(ISNONTEXT(Data),1))}
Counting logical values
The following array formula returns the number of logical values (TRUE or FALSE) in a range named Data:
{=SUM(IF(ISLOGICAL(Data),1))}
Counting error values in a range
Excel has three functions that help you determine whether a cell contains an error value:
n ISERROR: Returns TRUE if the cell contains any error value (#N/A, #VALUE!, #REF!, #DIV/0!,
#NUM!, #NAME?, or #NULL!)
n ISERR: Returns TRUE if the cell contains any error value except #N/A
n ISNA: Returns TRUE if the cell contains the #N/A error value
253