Help!!! I need to take the following data example and on another worksheet sum each item by pcs according to code

type pcs cases code
a1 100 10 l102bm
a2 150 15 k104bm
a3 180 18 l111bm
a1 120 12 l102bm
b2 140 14 h118bm
a1 100 10 l112mb
a3 130 13 h104bm


ie.. Result need to be----
type pcs code
a1 220 l102bm
a1 100 l112mb
a2 150 k104mb
a3 130 h104bm
a3 180 l111bm
b2 140 h118bm

i believe i need an index function to find unique values and then sum them in a sorted order.......

Any help would be greatly appreciated....

Thanks!!!!