1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Function TextJoinF(SearchR As String, RefR As Range, RefC As Long) As String RefLR = Cells(Rows.Count, RefR.Column).End(xlUp).Row Set RefR2 = Range(Cells(1, RefR.Column), Cells(RefLR, RefR.Column)) RepeatNo = Application.CountIf(RefR2, SearchR) For Each cell In RefR2 If cell = SearchR Then Result = Result & Cells(cell.Row, cell.Column + RefC) CountInput = CountInput + 1 If CountInput = RepeatNo Then Exit For End If Next TextJoinF = Result End Function |
Direct link: https://paste.plurk.com/show/L0m8fLMdYvjZ3r0XSRze