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

This formula eliminates the need for the IF function and takes advantage of the fact that:<br />

TRUE * 1 = 1<br />

and<br />

FALSE * 1 = 0<br />

FIGURE 17.16<br />

An array formula returns the number of text cells in the range.<br />

Eliminating intermediate formulas<br />

One key benefit of using an array formula is that you can often eliminate intermediate formulas in your<br />

worksheet, which makes your worksheet more compact and eliminates the need to display irrelevant calculations.<br />

Figure 17.17 shows a worksheet that contains pre-test and post-test scores for students. Column D<br />

contains formulas that calculate the changes between the pre-test and the post-test scores. Cell D17 contains<br />

a formula, shown here, that calculates the average of the values in column D:<br />

=AVERAGE(D2:D15)<br />

With an array formula, you can eliminate column D. The following array formula calculates the average of<br />

the changes but does not require the formulas in column D:<br />

{=AVERAGE(C2:C15-B2:B15)}<br />

How does it work? The formula uses two arrays, the values of which are stored in two ranges (B2:B15 and<br />

C2:C15). The formula creates a new array that consists of the differences between each corresponding element<br />

in the other arrays. This new array is stored in Excel’s memory, not in a range. The AVERAGE function<br />

then uses this new array as its argument and returns the result.<br />

The new array consists of the following elements:<br />

{11,15,-6,1,19,2,0,7,15,1,8,23,21,-11}<br />

The formula, therefore, is reduced to<br />

=AVERAGE({11,15,-6,1,19,2,0,7,15,1,8,23,21,-11})<br />

Excel evaluates the function and displays the results, 7.57.<br />

330

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

Saved successfully!

Ooh no, something went wrong!