Welcome to the forum.
If you're amenable to VBA, you can add this function to your workbook:
Function Cat(vInp As Variant, _
Optional sSep As String = "", _
Optional bCatEmpty As Boolean = False) As String
' Catenates the elements of vInp separated by sSep
' Empty values and null strings are ignored unless bCatEmpty is True
Dim vItem As Variant
Dim sItem As String
If bCatEmpty Then
For Each vItem In vInp
Cat = Cat & CStr(vItem) & sSep
Next vItem
Else
For Each vItem In vInp
sItem = CStr(vItem)
If Len(sItem) Then Cat = Cat & sItem & sSep
Next vItem
End If
If Len(Cat) Then Cat = Left(Cat, Len(Cat) - Len(sSep))
End Function
Then in D2, =Cat(IF(D4:D18<>"",$B4:$B18,""), ", ")
The formula MUST be confirmed with Ctrl+Shift+Enter.
Then you can copy across.
Bookmarks