Option Explicit
Sub TEST()
Dim Brr, Crr, i&, T$, T3$, T5$, T6$, TT$, S&
If [G65536].End(3).Row <> 1 Then Range([G2], [G65536].End(3)).ClearContents: Exit Sub
Brr = Range([G2], [A65536].End(3))
ReDim Crr(1 To UBound(Brr), 1 To 1)
For i = 1 To UBound(Brr)
T = Trim(Brr(i, 1)): T3 = Trim(Brr(i, 3)): T5 = Trim(Brr(i, 5)): T6 = Trim(Brr(i, 6))
If TT <> T Then TT = T: S = Val(T5)
If T3 = T6 And T3 <> "" Then Crr(i, 1) = S
Next
[G2].Resize(UBound(Crr), 1) = Crr
Erase Brr, Crr
End Sub