I have a spreedsheet with this type of data, for example

Product Group Quantity Size
2812 10 0.75
2812 100 0.75
2812 300 0.5
2817 100 0.25
2817 200 1
2845 1000 1.5


I want to be able to set up a formula that you enter a product group (2812) in a cell and it will for that product group go and sum up all the quantities for each size. The formula would go in the Sum column For Example

2812

Size Sum
0.375 2,342
0.5 2,342
0.75 1,992
1 883
1.25 284
1.5 90
2 290
2.5 16
3 32
3.5 0
4 26

So far i have had no luck with figuring out a formula that will accomplish all this, any help would be appreciated.

Thanks