I have a question how would select the data on separate tab? I was thinking about doing this but it doesn't work

=SUMPRODUCT(($I4=Sheet2!$H$21:$H$1997)*(J$3<=(Sheet2!$B$21:$B$1997))*(EOMONTH(J$3,0)>=(Sheet2!$B$21:$B$1997)))