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 />

FIGURE 14.3<br />

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

To count the number of times the most frequently occurring value appears in the range (in other words, the<br />

frequency of the mode), use the following formula:<br />

=COUNTIF(Data,MODE(Data))<br />

This formula returns 4, because the modal value (10) appears four times in the Data range.<br />

The MODE function works only for numeric values. It simply ignores cells that contain text. To find the most<br />

frequently occurring text entry in a range, you need to use an array formula.<br />

To count the number of times the most frequently occurring item (text or values) appears in a range named<br />

Data, use the following array formula:<br />

{=MAX(COUNTIF(Data,Data))}<br />

This next array formula operates like the MODE function, except that it works with both text and values:<br />

{=INDEX(Data,MATCH(MAX(COUNTIF(Data,Data)),COUNTIF(Data,Data),0))}<br />

Counting the occurrences of specific text<br />

The examples in this section demonstrate various ways to count the occurrences of a character or text string<br />

in a range of cells. Figure 14.4 shows a worksheet used for these examples. Various text strings appear in<br />

the range A1:A10 (named Data); cell B1 is named Text.<br />

ON the CD-ROM<br />

The companion CD-ROM contains a workbook that demonstrates the formulas in this section.<br />

The file is named counting text in a range.xlsx.<br />

258

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

Saved successfully!

Ooh no, something went wrong!