The quickest and easiest ways of getting the unique items are either to use Advanced Filter or to use a VBA user-defined function.
It is possible to do it with an array formula, however. This has traditionally been a two step process, such as described at Chip Pearson's web site (
), with one formula being used to extract the unique items and another to eliminate the blanks. As a result, an auxiliary column is needed for the extraction.
The following formula does the job all in one step (assuming the list contains no blanks). It returns error values once the unique values are exhausted. And it works for both numeric and text data:
=INDEX(List,SMALL(IF(MATCH(List,List,0)=ROW(List)-mmm,ROW(List)-mmm,65536),ROW()-nnn)) Array formula, so CTRL + Shift + Enter
mmm is one less than the first row in List
nnnn is one less than the first row receiving the formula
Here is a longer array formula that will tolerate blanks in the raw list and a list range that extends beyond your data. This formula may be copied down, and will return blank strings when the unique values have been exhausted. Note that the range specified by List must extend beyond your raw data.
="" & INDEX(List, SMALL(IF((List<>"")*(MATCH(IF(List="","",List),IF(List="","",List),0)=ROW(List)-mmm),ROW(List)-mmm,last-mmm),ROW()-nnn))
last is the row number of a blank element in List. It is most convenient if List is a fixed range extending beyond any expected data--so last would be the row number of the blank at the end of that range.
Note: this last formula will convert any numbers into text.
Brad