Microsoft Office Tutorials and References

In Depth Information

**Advanced Counting Formulas**

Yet another way to perform this count is to use an array formula:

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

Using Or criteria

To count cells by using an Or criterion, you can sometimes use multiple COUNTIF functions. The

following formula, for example, counts the number of sales made in January or February:

=COUNTIF(Month,”January”)+COUNTIF(Month,”February”)

You can also use the COUNTIF function in an array formula. The following array formula, for

example, returns the same result as the previous formula:

{=SUM(COUNTIF(Month,{“January”,”February”}))}

But if you base your Or criteria on cells other than the cells being counted, the COUNTIF function

won’t work. (Refer to Figure 7-2.) Suppose that you want to count the number of sales that meet

the following criteria:

h
Month is January,
or

h
SalesRep is Brooks,
or

h
Amount
is greater than 1,000

If you attempt to create a formula that uses COUNTIF, some double counting will occur. The

solution is to use an array formula like this:

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

Combining And and Or criteria

In some cases, you may need to combine And and Or criteria when counting. For example,

perhaps you want to count sales that meet the following criteria:

h
Month is January,
and

h
SalesRep is Brooks,
or SalesRep is Cook

You can add two COUNTIFS functions to get the desired result:

=COUNTIFS(Month,”January”,SalesRep,”Brooks”)+

COUNTIFS(Month,”January”,SalesRep,”Cook”)