18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating Formulas That Count and Sum 14<br />

Yet another way to perform this count is to use an array formula:<br />

{=SUM((Month=”January”)*(SalesRep=”Brooks”)*(Amount>1000))}<br />

Using Or criteria<br />

To count cells by using an Or criterion, you can sometimes use multiple COUNTIF functions. The following<br />

formula, for example, counts the number of sales made in January or February:<br />

=COUNTIF(Month,”January”)+COUNTIF(Month,”February”)<br />

You can also use the COUNTIF function in an array formula. The following array formula, for example,<br />

returns the same result as the previous formula:<br />

{=SUM(COUNTIF(Month,{“January”,”February”}))}<br />

But if you base your Or criteria on cells other than the cells being counted, the COUNTIF function won’t<br />

work. (Refer to Figure 14.2.) Suppose that you want to count the number of sales that meet the following<br />

criteria:<br />

n<br />

n<br />

Month is January, or<br />

SalesRep is Brooks, or<br />

n Amount is greater than 1000<br />

If you attempt to create a formula that uses COUNTIF, some double counting will occur. The solution is to<br />

use an array formula like this:<br />

{=SUM(IF((Month=”January”)+(SalesRep=”Brooks”)+(Amount>1000),1))}<br />

Combining And and Or criteria<br />

In some cases, you may need to combine And and Or criteria when counting. For example, perhaps you<br />

want to count sales that meet the following criteria:<br />

n<br />

n<br />

Month is January, and<br />

SalesRep is Brooks, or SalesRep is Cook<br />

This array formula returns the number of sales that meet the criteria:<br />

{=SUM((Month=”January”)*IF((SalesRep=”Brooks”)+<br />

(SalesRep=”Cook”),1))}<br />

Counting the most frequently occurring entry<br />

The MODE function returns the most frequently occurring value in a range. Figure 14.3 shows a worksheet<br />

with values in range A1:A10 (named Data). The formula that follows returns 10 because that value appears<br />

most frequently in the Data range:<br />

=MODE(Data)<br />

257

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

Saved successfully!

Ooh no, something went wrong!