So.
VBA code, pasted into a module:
Public Function ConcatAll(ByVal varData As Variant, Optional ByVal sDelimiter As String = vbNullString, Optional ByVal bUnique As Boolean = False) As String
Dim DataIndex As Variant
Dim strResult As String
If IsArray(varData) _
Or TypeOf varData Is Range _
Or TypeOf varData Is Collection Then
For Each DataIndex In varData
If Len(DataIndex) > 0 Then
If bUnique = True Then
If InStr(1, "||" & strResult & "||", "||" & DataIndex & "||", vbTextCompare) = 0 Then
trResult = strResult & "||" & DataIndex
End If
Else
strResult = strResult & "||" & DataIndex
End If
End If
Next DataIndex
strResult = Replace(Mid(strResult, 3), "||", sDelimiter)
Else
strResult = varData
End If
ConcatAll = strResult
End Function
Helper column in AA, copied down:
=WEEKNUM(T2)
Array Formula in sheet2, B3, copied down:
=concatall(IF(Sheet1!$AA$2:$AA$90=Sheet2!$A3,Sheet1!$F$2:$F$90,""),", ")
Formula in sheet 2 C3, copied across and down:
=COUNTIFS(Sheet1!$W:$W,Sheet2!C$2,Sheet1!$AA:$AA,Sheet2!$A3)
Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.
You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.
Don't type the curly brackets yourself - it won't work...
see sheet.
Bookmarks