18.11.2014 Views

Microsoft Office

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Part II<br />

Working with Formulas and Functions<br />

You can use these functions in an array formula to count the number of error values in a range. The following<br />

array formula, for example, returns the total number of error values in a range named Data:<br />

{=SUM(IF(ISERROR(data),1))}<br />

Depending on your needs, you can use the ISERR or ISNA function in place of ISERROR.<br />

If you would like to count specific types of errors, you can use the COUNTIF function. The following formula,<br />

for example, returns the number of #DIV/0! error values in the range named Data:<br />

=COUNTIF(Data,”#DIV/0!”)<br />

Advanced Counting Formulas<br />

Most of the basic examples I presented earlier in this chapter use functions or formulas that perform conditional<br />

counting. The advanced counting formulas that I present here represent more complex examples for<br />

counting worksheet cells, based on various types of criteria.<br />

CROSS-REF<br />

Some of these examples are array formulas. Refer to Chapters 17 and 18 for more information<br />

about array formulas.<br />

Counting cells by using the COUNTIF function<br />

Excel’s COUNTIF function is useful for single-criterion counting formulas. The COUNTIF function takes two<br />

arguments:<br />

n<br />

range: The range that contains the values that determine whether to include a particular cell in<br />

the count<br />

n criteria: The logical criteria that determine whether to include a particular cell in the count<br />

Table 14.2 lists several examples of formulas that use the COUNTIF function . These formulas all work with<br />

a range named Data. As you can see, the criteria argument proves quite flexible. You can use constants,<br />

expressions, functions, cell references, and even wildcard characters (* and ?).<br />

TABLE 14.2<br />

Examples of Formulas Using the COUNTIF Function<br />

=COUNTIF(Data,12) Returns the number of cells containing the value 12<br />

=COUNTIF(Data,”5”) Returns the number of cells greater than 5<br />

=COUNTIF(Data,A1)<br />

=COUNTIF(Data,”>”&A1)<br />

=COUNTIF(Data,”*”)<br />

=COUNTIF(Data,”???”)<br />

=COUNTIF(Data,”budget”)<br />

Returns the number of cells equal to the contents of cell A1<br />

Returns the number of cells greater than the value in cell A1<br />

Returns the number of cells containing text<br />

Returns the number of text cells containing exactly three characters<br />

Returns the number of cells containing the single word budget (not case<br />

sensitive)<br />

254

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!