Alternatively

Sheet2!C2:
=SUMPRODUCT((Sheet1!$C$2:$N$1001=$A2)*Sheet1!$B$2:$B$1001)
confirmed with Enter
copied down