Мое решение, если еще актуально...
Option Explicit
Sub priznak()
Dim wsh As Worksheet
Dim n, i As Integer
Set wsh = ThisWorkbook.Worksheets(1)
n = 2
Do While wsh.Cells(n, 1).Value <> ""
If wsh.Cells(n, 2).Value <> 0 Then
wsh.Cells(n, 3).Value = wsh.Cells(n, 2).Value
Else
i = 2
Do While wsh.Cells(i, 1).Value <> ""
If wsh.Cells(i, 2).Value <> 0 And wsh.Cells(i, 1).Value = wsh.Cells(n, 1).Value Then
wsh.Cells(n, 3).Value = wsh.Cells(i, 2).Value
End If
i = i + 1
Loop
End If
n = n + 1
Loop
End Sub
Option Explicit
Sub priznak()
Dim wsh As Worksheet
Dim n, i As Integer
Set wsh = ThisWorkbook.Worksheets(1)
n = 2
Do While wsh.Cells(n, 1).Value <> ""
If wsh.Cells(n, 2).Value <> 0 Then
wsh.Cells(n, 3).Value = wsh.Cells(n, 2).Value
Else
i = 2
Do While wsh.Cells(i, 1).Value <> ""
If wsh.Cells(i, 2).Value <> 0 And wsh.Cells(i, 1).Value = wsh.Cells(n, 1).Value Then
wsh.Cells(n, 3).Value = wsh.Cells(i, 2).Value
End If
i = i + 1
Loop
End If
n = n + 1
Loop
End Sub