Thread: Avoiding #NUM!
View Single Post
  #7   Report Post  
Harlan Grove
 
Posts: n/a
Default

Domenic wrote:
Assuming that Column A contains your data, try...

B1, copied down:

=IF(ROWS($B$1:B1)<=SUM(IF(LEN($A$1:$A$8)0,1/COUNTIF($A$1:$A$8,
$A$1:$A$8))),INDEX($A$1:$A$8,MATCH(SMALL(IF(COUNT IF(OFFSET($A$1:$A$8,
0,0,ROW($A$1:$A$8)-ROW($A$1)+1),$A$1:$A$8)=1,COUNTIF($A$1:$A$8,
"<"&$A$1:$A$8)),ROWS($B$1:B1)),COUNTIF($A$1:$A$8, "<"&$A$1:$A$8),0)),"")

...confirmed with CONTROL+SHIFT+ENTER. Actually, it would be more
efficient to enter the following formula in a cell, let's say, C1...

=SUM(IF(LEN(A1:A8)0,1/COUNTIF(A1:A8,A1:A8)))

...confirmed with CONTROL+SHIFT+ENTER, and then enter the following
formula in B1 and copy down:

=IF(ROWS($B$1:B1)<=$C$1,INDEX($A$1:$A$8,
MATCH(SMALL(IF(COUNTIF(OFFSET($A$1:$A$8,0,0,ROW($ A$1:$A$8)-ROW($A$1)+1),
$A$1:$A$8)=1,COUNTIF($A$1:$A$8,"<"&$A$1:$A$8)),RO WS($B$1:B1)),
COUNTIF($A$1:$A$8,"<"&$A$1:$A$8),0)),"")

...confirmed with CONTROL+SHIFT+ENTER.

....

But it'd be more efficient still not to use SMALL or the volatile
OFFSET at all. It requires using different formulas for the top most
result and the subsequent results.

C1 [array formula - topmost cell]:
=INDEX($A$1:$A$8,MATCH(0,COUNTIF($A$1:$A$8,"<"&$A$ 1:$A$8),0))

C2 [array formula - subsequent, fill down as needed]:
=IF(COUNTIF($A$1:$A$8,""&C1),INDEX($A$1:$A$8,MATC H(COUNTIF($A$1:$A$8,
"<="&C1),COUNTIF($A$1:$A$8,"<"&$A$1:$A$8),0)), "")