
Option Explicit
Sub abc()
Dim a, i, j, t
a = [a1].CurrentRegion.Offset(1).Resize(, 2).Value
For i = 1 To UBound(a) - 1
t = Split(a(i, 1), vbLf)
For j = 0 To UBound(t)
If t(j) = a(i, 2) Then
a(i, 1) = 1 / (UBound(t) + 1)
Exit For
End If
Next
If j = UBound(t) + 1 Then a(i, 1) = 0
Next
[c2].Resize(UBound(a) - 1) = a
End Sub