Page 301 - Excel 2007 Bible
P. 301
19_044039 ch14.qxp 11/21/06 11:06 AM Page 258
Part II
Working with Formulas and Functions
FIGURE 14.3
The MODE function returns the most frequently occurring value in a range.
To count the number of times the most frequently occurring value appears in the range (in other words, the
frequency of the mode), use the following formula:
=COUNTIF(Data,MODE(Data))
This formula returns 4, because the modal value (10) appears four times in the Data range.
The MODE function works only for numeric values. It simply ignores cells that contain text. To find the most
frequently occurring text entry in a range, you need to use an array formula.
To count the number of times the most frequently occurring item (text or values) appears in a range named
Data, use the following array formula:
{=MAX(COUNTIF(Data,Data))}
This next array formula operates like the MODE function, except that it works with both text and values:
{=INDEX(Data,MATCH(MAX(COUNTIF(Data,Data)),COUNTIF(Data,Data),0))}
Counting the occurrences of specific text
The examples in this section demonstrate various ways to count the occurrences of a character or text string
in a range of cells. Figure 14.4 shows a worksheet used for these examples. Various text strings appear in
the range A1:A10 (named Data); cell B1 is named Text.
The companion CD-ROM contains a workbook that demonstrates the formulas in this section.
ON the CD-ROM The file is named counting text in a range.xlsx.
ON the CD-ROM
258