11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

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

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

194<br />

Part II: Using Functions in Your <strong>Formula</strong>s<br />

Partial cell contents<br />

To count the number of cells that contain a string that includes the contents of the Text cell, use<br />

this formula:<br />

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

For example, if the Text cell contains the text Alpha, the formula returns 3 because three cells in<br />

the Data range contain the text alpha (cells A2, A8, and A10). Note that the comparison is not<br />

case sensitive.<br />

An alternative is a longer array formula that uses the SEARCH function:<br />

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

The SEARCH function returns an error if Text is not found in Data. The preceding formula counts<br />

one for every cell where SEARCH does not find an error. Because SEARCH is not case sensitive,<br />

neither is this formula.<br />

If you need a case-sensitive count, you can use the following array formula:<br />

{=SUM(IF(LEN(Data)-LEN(SUBSTITUTE(Data,Text,””))>0,1))}<br />

If the Text cells contain the text Alpha, the preceding formula returns 2 because the string<br />

appears in two cells (A2 and A8).<br />

Like the SEARCH function, the FIND function returns an error if Text is not found in Data, as in<br />

this alternative array formula:<br />

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

Unlike SEARCH, the FIND function is case sensitive.<br />

Total occurrences in a range<br />

To count the total number of occurrences of a string within a range of cells, use the following<br />

array formula:<br />

{=(SUM(LEN(Data))-SUM(LEN(SUBSTITUTE(Data,Text,””))))/<br />

LEN(Text)}<br />

If the Text cell contains the character B, the formula returns 7 because the range contains seven<br />

instances of the string. This formula is case sensitive.

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

Saved successfully!

Ooh no, something went wrong!