Copy the first three columns to another sheet or location. Make use of "Remove Duplicates." Utilize a formula similar to this one to determine the total quantities:
=SUMIFS($D$2:$D$500, $A$2:$A$500, $A2, $B$2:$B$500, $B2, $C$2:$C$500, $C2)
Then drag the formula to find other quantities.