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

This formula works by creating a new array that contains the original values but without the errors. The IF<br />

function effectively filters out error values by replacing them with an empty string. The SUM function then<br />

works on this “filtered” array. This technique also works with other functions, such as AVERAGE, MIN, and<br />

MAX.<br />

NEW FEATURE<br />

If only Excel 2007 users will use your worksheet, you can use this more efficient version,<br />

which uses the new IFERROR function:<br />

{=SUM(IFERROR(G1:G7,””))}<br />

An array formula can sum a range of values, even if the range contains errors.<br />

Counting the number of error values in a range<br />

The following array formula is similar to the previous example, but it returns a count of the number of error<br />

values in a range named Data:<br />

{=SUM(IF(ISERROR(Data),1,0))}<br />

This formula creates an array that consists of 1s (if the corresponding cell contains an error) and 0s (if the<br />

corresponding cell does not contain an error value).<br />

You can simplify the formula a bit by removing the third argument for the IF function. If this argument<br />

isn’t specified, the IF function returns FALSE if the condition is not satisfied (that is, the cell does not contain<br />

an error value). In this context, Excel treats FALSE as a 0 value. The array formula shown here performs<br />

exactly like the previous formula, but it doesn’t use the third argument for the IF function:<br />

{=SUM(IF(ISERROR(Data),1))}<br />

Actually, you can simplify the formula even more:<br />

{=SUM(ISERROR(Data)*1)}<br />

This version of the formula relies on the fact that:<br />

and<br />

TRUE * 1 = 1<br />

FALSE * 1 = 0<br />

334

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

Saved successfully!

Ooh no, something went wrong!