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 Array Formulas 18<br />

FIGURE 18.8<br />

Ranking data with the Excel program’s RANK function and with array formulas.<br />

Working with Multicell Array Formulas<br />

The preceding chapter introduced array formulas entered into multicell ranges. In this section, I present a<br />

few more array multicell formulas. Most of these formulas return some or all of the values in a range, but<br />

rearranged in some way.<br />

ON the CD-ROM<br />

The examples in this section are available on the companion CD-ROM. The file is named<br />

multi-cell array formulas.xlsx.<br />

Returning only positive values from a range<br />

The following array formula works with a single-column vertical range (named Data). The array formula is<br />

entered into a range that’s the same size as Data and returns only the positive values in the Data range.<br />

(Zeroes and negative numbers are ignored.)<br />

{=INDEX(Data,SMALL(IF(Data>0,ROW(INDIRECT(“1:”&ROWS(Data)))),<br />

ROW(INDIRECT(“1:”&ROWS(Data)))))}<br />

As you can see in Figure 18.9, this formula works, but not perfectly. The Data range is A5:A24, and the<br />

array formula is entered into C5:C24. However, the array formula displays #NUM! error values for cells that<br />

don’t contain a value.<br />

This modified array formula, entered into range E5:E24, use the IFERROR function to avoid the error value<br />

display:<br />

{=IFERROR(INDEX(Data,SMALL(IF(Data>0,ROW(INDIRECT(“1:”&ROWS(Data)))),RO<br />

W(INDIRECT(“1:”&ROWS(Data))))),””)}<br />

345

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

Saved successfully!

Ooh no, something went wrong!