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.

Chapter 15: Performing Magic with Array <strong>Formula</strong>s 407<br />

This modified array formula, entered into range E4:E23, uses the IFERROR function to avoid the<br />

error value display:<br />

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

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

The IFERROR function was introduced in Excel 2007. For compatibility with older versions, use<br />

this formula entered in G4:G23:<br />

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

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

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

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

Returning nonblank cells from a range<br />

The following formula is a variation on the formula in the preceding section. This array formula<br />

works with a single-column vertical range named Data. The array formula is entered into a range<br />

of the same size as Data and returns only the nonblank cell in the Data range.<br />

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

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

For compatibility with versions prior to Excel 2007, use this formula:<br />

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

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

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

(Data))))))}<br />

Reversing the order of cells in a range<br />

In Figure 15-10, cells C4:C13 contain a multicell array formula that reverses the order of the values<br />

in the range A4:A13 (which is named Data).<br />

The array formula is<br />

{=IF(INDEX(Data,ROWS(Data)-ROW(INDIRECT<br />

(“1:”&ROWS(Data)))+1)=””,””,INDEX(Data,ROWS(Data)–<br />

ROW(INDIRECT(“1:”&ROWS(Data)))+1))}

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

Saved successfully!

Ooh no, something went wrong!