Private Sub CommandButton1_Click()
Dim Dl As Long
Dl = [C60000].End(xlUp).Row
Range("C1:C" & Dl).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=[G1], Unique:=True
Range("H2:H" & [G60000].End(xlUp).Row).FormulaR1C1 = _
"=SUMIF(RC[-5]:R[" & Dl & "]C[-5],RC[-1],RC[-3]:R[" & Dl & "]C[-3])"
End Sub