COUNTIF with multiplication

I’m trying to create a spreadsheet for counting various items of same type.

I have two columns. One is color, the other is count. I may have many rows containing the same value for color (e.g. Blue), I also have a count column, which shows how many items that I have for the same row (e.g. 3). So while counting instead of adding 1 for each row, I want to add count amount to the total sum for that color.

e.g. If a row contains Blue as color and 3 as count, I want to add 3 to the total number of blues.

See Data - Subtotals

SubTotals

Wow, that’s pretty interesting. Thanks. Can I move totals to another place? If I want to create a small table with it, for example?

I’ve found that SUMIF also did what I looked for. I gave the color values for condition, and the counts for sum range.