Sub Demo()
Dim TDL&(2 To 5)
For C& = 2 To 5: TDL(C) = Cells(Me.Rows.Count, C).End(xlUp).Row: Next
AD$ = Range("B6", Cells(Application.Max(TDL), 5)).Address
Application.ScreenUpdating = False
With [L6].CurrentRegion.Rows
With .Offset(, 1)
.ClearContents
.Columns(1).Formula = "=COUNTIF(" & AD & ",L6)"
End With
For R& = 6 To .Item(.Count).Row
With Cells(R, 13)
If .Value Then .Resize(, .Value).FormulaArray = "=SMALL(IF(" & AD & "=$L" & R & ",ROW(" & AD & ")),COLUMN()-12)" Else .Value = ""
End With
Next
End With
With [L6].CurrentRegion
.Formula = .Value
End With
End Sub