In Column A i aspect Prices and Column B i aspect Code

Try this in Cell C2

=SUMIF(B1:B6,"a",A1:A6)