Page 390 - Excel 2007 Bible
P. 390
23_044039 ch18.qxp 11/21/06 11:09 AM Page 347
Performing Magic with Array Formulas
Returning a list of unique items in a range
If you have a single-column range named Data, the following array formula returns a list of the unique
items in the range (the list with no duplicated items):
(“1:”&ROWS(Data))),MATCH(Data,Data,0),””),ROW(INDIRECT
(“1:”&ROWS(Data)))))}
This formula doesn’t work if the Data range contains any blank cells. The unfilled cells of the array formula
display #NUM!.
The following modified version eliminates the #NUM!. display by using the Excel 2007 IFERROR function.
{=IFERROR(INDEX(Data,SMALL(IF(MATCH(Data,Data,0)=ROW(INDIRECT
(“1:”&ROWS(data))),MATCH(Data,Data,0),””),ROW(INDIRECT
(“1:”&ROWS(Data))))),””)}
Figure 18.10 shows an example. Range A5:A23 is named Data, and the array formula is entered into range
C5:C23. Range E5:E23 contains the array formula that uses the IFERROR function.
FIGURE 18.10 {=INDEX(Data,SMALL(IF(MATCH(Data,Data,0)=ROW(INDIRECT 18
Using an array formula to return unique items from a list.
Displaying a calendar in a range
Figure 18.11 shows the results of one of my favorite multicell array formulas, a “live” calendar displayed in
a range of cells. If you change the date at the top, the calendar recalculates to display the dates for the
month and year.
347

