Simplest way that I can think of would be to increase the second row number reference to be that of the last possible row, which for version 2010 is 1048576.
The formula for column D would then read:
Formula:
=IFERROR(INDEX(A$4:A$1048576,AGGREGATE(15,6,(ROW($A:$A))/ISERROR(MATCH(A$4:A$1048576,C$4:C$1048576,0)),ROW(A1))),"")
The formula for column E would then read:
Formula:
=IFERROR(INDEX(B$4:B$1048576,MATCH(D4,A$4:A$1048576,0)),"")
In the attached file I added conditional formatting to column D so that any zeros would have a fount color of white and not be visible.
Let me know if you have any questions.
Bookmarks