This will create a list to the side:
Sub dupremoveavg()
Dim ws As Worksheet
Dim lastrow As Long
Set ws = Sheets("Sheet13") ' Change to your sheet
With ws
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
With .Range("A1:B" & lastrow)
.Offset(, 4).Value = .Value
End With
With .Range("B2:B" & lastrow)
.Offset(, 4).FormulaR1C1 = "=AVERAGEIF(C1,RC1,C[-4])"
.Offset(, 4).Value = .Offset(, 4).Value
End With
.Range("E1:F" & lastrow).RemoveDuplicates 1, xlYes
End With
End Sub
Or for non vba you can use AVERAGEIF()
=AVERAGEIF(A:A,A2,B:B)
EDIT
As per your edits.
Use this formula in C2 and copy down.
=IF(A2<>A1,AVERAGEIF(A2:INDEX($A2:$A$20000,MATCH(TRUE,(INDEX($A2:$A$20000<>A2,)),0)),A2,B2:INDEX($B2:$B$20000,MATCH(TRUE,(INDEX($A2:$A$20000<>A2,)),0))),"")
This formula will reference a dynamic range, in that it will alwyas grow or shrink to accommodate the changing number of rows.
=IF(A2<>A1,AVERAGEIF(A2:INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1),MATCH(TRUE,(INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1)<>A2,)),0)),A2,B2:INDEX($B2:INDEX(B:B,MATCH(1E+99,A:A)+1),MATCH(TRUE,(INDEX($A2:INDEX(A:A,MATCH(1E+99,A:A)+1)<>A2,)),0))),"")