Not sure I understood all that
What I have is
1. A Sub that removes duplicates in a single column (B, C, D)
2. A Sub that takes the de-duped single column (B, C, D) and removes substrings in a multiple substring column (E)
3. Logic that takes each piece of a multi-substring column (E) and removes that substring from the rest of that column (E)
Do you really need 'True' in column O? That will get into more complicated and longer running code
Option Explicit
Sub DeDup()
Dim rData As Range, rCell As Range, rNext As Range, rLast As Range
Dim s As String
Dim v As Variant
Dim i As Long
Application.ScreenUpdating = False
Set rData = Worksheets("Test_ph").Cells(1, 1).CurrentRegion
Call CheckForDupsInSingleValueColumn(rData.Columns(2))
Call CheckForDupsInSingleValueColumn(rData.Columns(3))
Call CheckForDupsInSingleValueColumn(rData.Columns(4))
Call CheckForDupsSingleAgaintMultiple(rData.Columns(2), rData.Columns(5))
Call CheckForDupsSingleAgaintMultiple(rData.Columns(3), rData.Columns(5))
Call CheckForDupsSingleAgaintMultiple(rData.Columns(4), rData.Columns(5))
'check for dups in col E and remove
With rData.Columns(5)
For Each rCell In .Cells
Set rNext = .Cells(rCell.Row + 1, 1)
Set rLast = rNext.End(xlDown)
v = Split(rCell.Value, ";")
For i = LBound(v) To UBound(v)
Call Range(rNext, rLast).Replace(v(i) & ";", vbNullString, xlPart)
Call Range(rNext, rLast).Replace(v(i), vbNullString, xlPart) ' no ; on last one
Next I
Next
End With
Application.ScreenUpdating = True
End Sub
Private Sub CheckForDupsInSingleValueColumn(rSingleCol As Range)
Dim rCell As Range, rNext As Range, rLast As Range
With rSingleCol
For Each rCell In .Cells
If Application.WorksheetFunction.CountIf(.Cells, rCell.Value) > 1 Then
Set rNext = .Cells(rCell.Row + 1, 1)
Set rLast = rNext.End(xlDown)
Call Range(rNext, rLast).Replace(rCell.Value, vbNullString, xlWhole)
End If
Next
End With
End Sub
Private Sub CheckForDupsSingleAgaintMultiple(rSingleCol As Range, rMultiple As Range)
Dim rCell As Range
Dim s As String
With rSingleCol
For Each rCell In .Cells
If Left(rCell.Value, 1) = "+" Then
s = Right(rCell.Value, Len(rCell.Value) - 1)
Else
s = rCell.Value
End If
If Len(s) > 1 Then
Call rMultiple.Replace(s & ";", vbNullString, xlPart)
Call rMultiple.Replace(s, vbNullString, xlPart) ' no ; on last one
End If
Next
End With
End Sub