i have around 5000 rows of data and 4 columns

Column1 Column2 Column3 Column4
a 1 P 19
a 2 p 21
a 2 p 12
a 4 p 42
b 4 p 12
b 4 p 32
c 7 p 68
c 7 a 72
c 8 p 52
c 8 p 12

I want a column 5 where it subtotals column 4 by groups, so for this example, column5 would be

Column5
19
33
33
42
44
44
68
72
64
64


Im not entirely sure the best way to do this. Any help is appreciated