...I did this method.
On Sheet2 I put both formulas in separate cells. I modified each as follows:
In box A1:
=IF(ISNA(MATCH(Sheet1!D1,Sheet1!B:B,1)*1),0,(INDEX(Sheet1!A:B,MATCH(Sheet1!D1,Sheet1!B:B,1),1)))
This gave me the result of the first column (1-50) on the search in D1.
In box A2...