The following VBA code will do what you want
Sub STots()
Dim Rw 'Row being evaluated
Dim Var 'The value in column A
Dim Srw 'the 1st row containing VAR
Dim Stot 'sub-total of values in column B
Rw = 1: Srw = 1
Var = Cells(Rw, 1)
Do
Do
Stot = Stot + Cells(Rw, 2)
Rw = Rw + 1
Loop While Cells(Rw, 1) = Var
Cells(Srw, 3) = Stot
Stot = 0: Srw = Rw: Var = Cells(Rw, 1)
Loop Until Cells(Rw, 1) = ""
End Sub
The above assumes that your data list starts in cell A1.
If not, adjust as necessary.
regards,
Don