Sounds like you could use SUMIF, e.g.

=SUMIF(A1:A30,"value",B1:B30)