I have a table in Excel where I have categories and money like so:

I want to calculate the sum of all A category and B And C.
So I have to put a rule like this for the cell B1
=if(cell next B1 witch is A1="a";get B1) and do the same for all other cells in B row.
How can I get the total of money collected from category A and from category B?