I'd suggest a couple of changes
Function WhatRules2(rng1 As Range, rng2 As Range) As Variant Dim i As Long Dim s As String WhatRules2 = CVErr(xlErrNA) For i = 1 To rng1.Columns.Count - 1 Step 2 If rng1.Cells(1, i).Value = "Yes" Then s = s & ", " & rng2.Cells(1, i).Value Next i If Len(s) > 0 Then WhatRules2 = Mid(s, 3) End Function