Add value from column 2 if column 1 equals to "Yes"


I want to create a histogram of spenditures and automatically summarize them in a table next to it. So if a value (cell b2) is in the category (b1) "Food" i want the table to automatically add it to its sum.

Category Value
Food 2
Food 2
Sleep 4

Table summary:
Food: [Sum of all values in Value column with category value "Food"]
Accomodation: [Sum of all values in Value column w category value "Accomodation"]

What should the formula in the Table summary look like?


Best regards.