Spreadsheet: 217516d1362087350-sort-formula-allow-for-duplicates-excel-array-sort-problem-2
Sheet: Sort Formula Problem

 |  |  |  | intermediate | intermediate
array | DragList | Data Copy |  | sort array | sort array | array |  | SMALL col E | SMALL col E | SMALL full | SMALL full |  | SMALL col F | SMALL col F | SMALL full | SMALL full
(occurrence) | Occurrence |  |  | OLD | NEW | (wanted) |  | OLD (array) | OLD (DragList) | OLD (array) | OLD (DragList) |  | NEW (array) | NEW (DragList) | NEW (array) | NEW (DragList)
 |  | a | 100
 |  | b | 400 | 4 |  |  |  | 1 |  | 1
 |  | a | 200 | 1 |  |  |  | 1 |  | 1
 |  | c | 600 | 6 |  |  |  | 4 |  | 4
 |  | a | 300 | 1 |  |  |  | 4 |  | 4
 |  | b | 500 | 4 |  |  |  | 6 |  | 6
 |  |  |  |  |  |  |  |  |  |  |  |  | correct | correct | DO NOT UNDERSTAND
 |  |  |  | i.e. | i.e.
 |  |  |  | a=1 | a=1 |  |  | MATCH col E | MATCH col E | MATCH full | MATCH full |  | MATCH col F | MATCH col F | MATCH full | MATCH full
 |  |  |  | a=1 | a=2 |  |  | OLD (array) | OLD (DragList) | OLD (array) | OLD (DragList) |  | NEW (array) | NEW (DragList) | NEW (array) | NEW (DragList)
 |  |  |  | a=1 | a=3
 |  |  |  | b=4 | b=4 |  |  | 1 |  | 1
 |  |  |  | b=4 | b=5 |  |  | 1 |  | 1
 |  |  |  | c=6 | c=6 |  |  | 2 |  | 2
 |  |  |  |  |  |  |  | 2 |  | 2
 |  |  |  |  |  |  |  | 4 |  | 4
 |  |  |  |  |  |  |  |  |  |  |  |  | correct | correct | RESULTS AS FOR $I to $L
 |  |  |  |  |  |  |  | INDEX col E | INDEX col E | INDEX full | INDEX full |  | INDEX col F | INDEX col F | INDEX full | INDEX full
 |  |  |  |  |  |  |  | OLD (array) | OLD (DragList) | OLD (array) | OLD (DragList) |  | NEW (array) | NEW (DragList) | NEW (array) | NEW (DragList)
 |  |  |  |  |  |  |  | a=100 |  | a=100
 |  |  |  |  |  |  |  | a=100 |  | a=100
 |  |  |  |  |  |  |  | b=400 |  | b=400
 |  |  |  |  |  |  |  | b=400 |  | b=400
 |  |  |  |  |  |  |  | c=600 |  | c=600
 |  |  |  |  |  |  |  |  |  |  |  |  | correct | correct | RESULTS AS FOR $I to $L
IFERROR(IF(LEN($C$11:$C$16)=0, "", IF(ISNUMBER($C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1)),"")
IFERROR(SMALL(IF(LEN($C$11:$C$16)=0, "", IF(ISNUMBER($C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1)), ROW()-ROW($A$11)+1),"")
IFERROR(MATCH(SMALL(IF(LEN($C$11:$C$16)=0, "", IF(ISNUMBER($C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1)), ROW()-ROW($A$11)+1), IF(LEN($C$11:$C$16)=0, "", IF(ISNUMBER($C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16), COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1)), 0),"")
IFERROR(
 | MATCH(
 |  | SMALL(
 |  |  | IF( | LEN($C$11:$C$16)=0,
 |  |  |  | "",
 |  |  |  | IF( | ISNUMBER($C$11:$C$16),
 |  |  |  |  | COUNTIF($C$11:$C$16, "<"&$C$11:$C$16),
 |  |  |  |  | COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1 |  |  |  |  |  |  |  | +COUNTIF($C$11:OFFSET($C$11,ROW($1:$16)-1,0),$C$11:$C$16)-1
 |  |  |  | )
 |  |  | ),
 |  |  | ROW()-ROW($A$11)+1
 |  | ),
 |  | IF( | LEN($C$11:$C$16)=0,
 |  |  | "",
 |  |  | IF( | ISNUMBER($C$11:$C$16),
 |  |  |  | COUNTIF($C$11:$C$16, "<"&$C$11:$C$16),
 |  |  |  | COUNTIF($C$11:$C$16, "<"&$C$11:$C$16)+SUM(IF(ISNUMBER($C$11:$C$16), 1, 0))+1 |  |  |  |  |  |  |  |  | +COUNTIF($C$11:OFFSET($C$11,ROW($1:$16)-1,0),$C$11:$C$16)-1
 |  |  | )
 |  | ),
 |  | 0
 | )
 | ""
)