Perhaps Sumif()?

=Sumif(A13:A16,1,B13:B16)

This will sum values in B13:B16 which having a corresponding 1 in A13:A16


adjust ranges to suit.