For what it's worth, here's a version that allows empty cells:
| H | I | J | K |
---|
cat | aardvark | | | |
dog | ape | | | |
ape | cat | | | |
mouse | dog | | | |
cat | gerbil | | | |
horse | horse | | | |
mouse | mouse | | | |
gerbil | snake | | | |
zebra | | | | |
zebra | | | | |
| | | | |
aardvark | | | | |
snake | | | | |
SNAKE | | | | |
Snake | | | | |
| | | | |
cat | | | | |
| | | | |
| | | | |
| | | | |
<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"]9[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]11[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]12[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]13[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]14[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]15[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]16[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]17[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]18[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]19[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]20[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
</tbody>
Sheet9
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]J1[/TH]
[TD="align: left"]{=INDEX(
H:H,MAX(IF((COUNTIF($H$1:$H$20,"<"&$H$1:$H$20)=0)*($H$1:$H$20<>""),ROW($H$1:$H$20))))}[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]J2[/TH]
[TD="align: left"]{=IF(
ROW()>$K$1,"",INDEX(H:H,MATCH(MIN(COUNTIF($H$1:$H$20,"<"&IF((COUNTIF($J$1:$J1,$H$1:$H$20)=0)*($H$1:$H$20<>""),$H$1:$H$20,"zzz"))),COUNTIF($H$1:$H$20,"<"&IF(COUNTIF($J$1:$J1,$H$1:$H$20)=0,$H$1:$H$20,"zzz")),0)))}[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]K1[/TH]
[TD="align: left"]{=SUM(
IF(FREQUENCY(IFERROR(MATCH(H1:H20,H1:H20,0),FALSE),ROW(H1:H20)),1))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
Put in the J1 and K1 formulas. Then put in the J2 formula and copy down. Actual empty cells are ignored. Cells containing spaces will be considered unique entries. Cells containing nulls as a result of a formula will throw things off.
And to test the efficiency, I created a list of 3000 items and put the formulas in. It took 45 minutes to calculate the sheet. Based on that, these formulas should only be used on short lists. Your 3000 item list can be handled much better with the pivot table or a macro.