Я предполагаю, что ваши данные находятся в столбце A Листа1. Этот код можно оптимизировать больше, но сейчас он должен быть достаточно быстрым, чтобы обрабатывать сотни строк в секундах
Sub Main()
Dim i As Long
Dim j As Long
Dim str As String
Dim arr As Variant
Dim arr2 As Variant 'array of the result
Dim arrTemp As Variant
Dim rng As Range
'put everything into an array
Set rng = Worksheets("Sheet1").UsedRange.Columns(1)
arr = rng.Value
arr2 = arr
arr2(1, 1) = "" 'delete the first row since there won't be any value above it to compare
'loop thru the array rows and split the values of each element and compare it with the element above it
For i = 2 To UBound(arr, 1)
arrTemp = Split(arr(i, 1), " | ")
arr2(i, 1) = "No" 'assume there is no match at first
For j = 0 To UBound(arrTemp)
If InStr(arr(i - 1, 1), arrTemp(j)) > 0 Then
arr2(i, 1) = "Yes"
Exit For 'there was a match get out
End If
Next j
Next i
'paste the results
rng.Offset(0, 1).Value = arr2
End Sub
Вывод