Hi I'm a totally new into VBA/Coding and my problem is somewhat complicated (at least for me).. I hope there's anyone can help me on this 
Table1.JPG
Row 17 - Row 383 is my basic schedule table where it starts. '7'(hours) & team A/B/C are the variables which people enters in, delete out or change. I previously used 'concatif' function I got from someone else to list out the names who entered a value '7' from the schedule table above. The result currently shows as Row 9 - Row 10 with this 'concatif' function. The dates in the result table is simply '=Today()' and '=Workday(x,y)' formula. And of course the dates in the result table changes everyday accordingly.
Now I'm trying to improve this little bit on the result table by listing out the names separately based by each person's team. Hopefully, I wish the a new result table show as below.
Table3.JPG
I've never done with the coding before.. so if there's anyone who can help with this.. I will learn a lot from it and of course would be greatly appreciated. Thanks,
Current Cell C10
=ConcatIf(INDIRECT("C" & MATCH(C$9,$B$19:$B$383,0)+18 & ":O" & MATCH(C$9,$B$19:$B$383,0)+18), $C$17:$O$17, ", ")
Current 'concatif' Coding
Function ConcatIf(ByVal compareRange As Range, Optional ByVal stringsRange As Range, Optional Delimiter As String, Optional NoDuplicates As Boolean) As String
Rem the first three argumens of ConcatIf mirror those of SUMIF
Rem the Delimiter and NoDuplicates arguments are optional (default "" and False)
Dim i As Long, j As Long
With compareRange.Parent
Set compareRange = Application.Intersect(compareRange, Range(.UsedRange, .Range("a1")))
End With
If compareRange Is Nothing Then Exit Function
If stringsRange Is Nothing Then Set stringsRange = compareRange
Set stringsRange = compareRange.Offset(stringsRange.Row - compareRange.Row, stringsRange.Column - compareRange.Column)
For i = 1 To compareRange.Rows.Count
For j = 1 To compareRange.Columns.Count
If (Application.CountIf(compareRange.Cells(i, j), ">0") = 1) Then
If InStr(ConcatIf, Delimiter & CStr(stringsRange.Cells(i, j))) <> 0 Imp Not (NoDuplicates) Then
ConcatIf = ConcatIf & Delimiter & CStr(stringsRange.Cells(i, j))
End If
End If
Next j
Next i
ConcatIf = Mid(ConcatIf, Len(Delimiter) + 1)
End Function
Bookmarks