Thanks! Though if it doesnt bother you, may you breakdown the use of the SMALL function and what it means to (ROW)-(ROW)+1. Ive never understood ROW functions nor SMALL
INDEX(resultrange,SMALL(IF(testrange=test,ROW(testrange)-ROW(INDEX(testrange,1,1))+1),ROWS(expandingimplementationrange))
Filled in with a concrete example...
INDEX($A$2:$A$6,SMALL(IF($B$2:$B$6="qad",ROW($B$2:$B$6)-ROW($B$2)+1),ROWS($E$2:E2)
where
[1] $A$2:$A$6 >> resultrange
[2] $B$2:$B$6 >> testrange
[3] "qad" >> test (more precisely: equality test)
[4] ROW($B$2:$B$6)-ROW($B$2)+1 = ROW($B$2:$B$6)-ROW(INDEX($B$2:$B$6,1,1))+1 >> ROW(testrange)-ROW(INDEX(testrange,1,1))+1
The [4] means an array of integers startin at 1 going up to the size of the testrange. For our example, this would give us {1;2;3;4;5}, the relative row numbers. ROW returns the native row numbers of the range it's fed with. ROW($B$2:$B$6)-ROW($B$2)+1 makes them relative.
[5] $E$2:E2, which grows when copied down to $E$2:E3, $E$2:E4, etc. >> expandingimplementationrange. Applyin ROWS to this, we get 1, 2, 3, 4, and 5, the progressive size of the range. These numbers serve as k of SMALL(array, k).
This translates as: get me from [4] the first smallest relative row number, the second smallest relative row number
So INDEX/SMALL formula says effectively: Hey SMALL fed INDEX with the next relative row number; hey INDEX return a the result from resultrange from that relative row position.
Hope this helps.
Feed INDEX with row numbers one by one which obtain when testrange=test, i.e. $B$2:$B$6="qad"