The VBA alternative would be like this........
Sub sumpopulation()
Dim rngc1 As Range, rngc2 As Range, rngs As Range, cell As Range, cella As Range
Dim lr1 As Long
lr1 = Cells(Rows.Count, "C").End(xlUp).Row
Set rngc1 = Range("C2:C" & lr1)
Application.ScreenUpdating = False
For Each cell In rngc1
m = Application.WorksheetFunction.CountIf(rngc1, cell.Value)
n = Application.WorksheetFunction.Match(cell.Value, rngc1, 0)
Set rngs = Range(Cells(n + 1, "E"), Cells(m + n, "E"))
If cell.Value <> cell.Offset(-1, 0).Value Then
cell.Offset(0, 3) = Application.WorksheetFunction.SumIf(rngc1, cell.Value, rngs)
End If
Set rngc2 = Range(Cells(n + 1, "D"), Cells(m + n, "D"))
For Each cella In rngc2
If cella.Value <> cella.Offset(-1, 0).Value Then
cella.Offset(0, 3) = Application.WorksheetFunction.SumIf(rngc2, cella.Value, rngs)
End If
Next cella
Next cell
Application.ScreenUpdating = True
End Sub
Bookmarks