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.

Performing Magic with<br />

Array Formulas<br />

The preceding chapter provides an introduction to arrays and array formulas<br />

and presented some basic examples to whet your appetite. This chapter<br />

continues the saga and provides many useful examples that further<br />

demonstrate the power of this feature.<br />

I selected the examples in this chapter to provide a good assortment of the various<br />

uses for array formulas. You can use most of them as-is. You will, of course,<br />

need to adjust the range names or references used. Also, you can modify many of<br />

the examples easily to work in a slightly different manner.<br />

Working with Single-Cell Array<br />

Formulas<br />

As I describe in the preceding chapter, you enter single-cell array formulas into a<br />

single cell (not into a range of cells). These array formulas work with arrays contained<br />

in a range or that exist in memory. This section provides some additional<br />

examples of such array formulas.<br />

ON the CD-ROM<br />

The examples in this section are available on the companion<br />

CD-ROM. The file is named single-cell array formulas.xlsx.<br />

IN THIS CHAPTER<br />

More examples of single-cell<br />

array formulas<br />

More examples of multicell array<br />

formulas<br />

Returning an array from a<br />

custom VBA function<br />

Summing a range that contains errors<br />

You may have discovered that the SUM function doesn’t work if you attempt to<br />

sum a range that contains one or more error values (such as #DIV/0! or #N/A).<br />

Figure 18.1 shows an example. The formula in cell C11 returns an error value<br />

because the range that it sums (C4:C10) contains errors.<br />

The following array formula, in cell C13, overcomes this problem and returns the<br />

sum of the values, even if the range contains error values:<br />

{=SUM(IF(ISERROR(C4:C10),””,C4:C10))}<br />

333

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

Saved successfully!

Ooh no, something went wrong!