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

Returning a list of unique items in a range<br />

If you have a single-column range named Data, the following array formula returns a list of the unique<br />

items in the range (the list with no duplicated items):<br />

{=INDEX(Data,SMALL(IF(MATCH(Data,Data,0)=ROW(INDIRECT<br />

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

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

This formula doesn’t work if the Data range contains any blank cells. The unfilled cells of the array formula<br />

display #NUM!.<br />

The following modified version eliminates the #NUM!. display by using the Excel 2007 IFERROR function.<br />

{=IFERROR(INDEX(Data,SMALL(IF(MATCH(Data,Data,0)=ROW(INDIRECT<br />

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

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

Figure 18.10 shows an example. Range A5:A23 is named Data, and the array formula is entered into range<br />

C5:C23. Range E5:E23 contains the array formula that uses the IFERROR function.<br />

FIGURE 18.10<br />

Using an array formula to return unique items from a list.<br />

Displaying a calendar in a range<br />

Figure 18.11 shows the results of one of my favorite multicell array formulas, a “live” calendar displayed in<br />

a range of cells. If you change the date at the top, the calendar recalculates to display the dates for the<br />

month and year.<br />

347

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

Saved successfully!

Ooh no, something went wrong!