Hi Poren,
Glad that it works.
As of now we have used absolute reference at sheet1. To make it dynamic, I would suggest you to create dynamic named range for col A and B of sheet1 as follows:
Go to Name manager(keyboard shortcut ctrl+f3)...in name box give any name(e.g.ColAdyn) and ion refer to box write =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A:$A,0)-2,1)
This will make column A dynamic
In order to make column B dynamic, do the same as follows:
In name box, give a name (for e.g. ColBDyn)
In refer to box write: =OFFSET(ColAdyn,0,1)
Now pass these pass these references in the formula. Hence, our formula becomes:
=IFERROR(INDEX(ColAdyn,SMALL(IF(ColBDyn=Sheet2!$A$2,ROW(ColBDyn)-1,""),ROW(Sheet1!A1))),"") (press ctrl+shift+enter)...and copy it down as you need(say till 100 rows)
Now at sheet1, if you write 9(at A10) and 1 at (B10), B8 of sheet2 will be populated with 9 automatically.
Let me know if it's fine...
Kaushik