I need the average of cells in col C for all the cells in col B that have 1
Then the average of cells in col C for all the cells in col B that have 2
.
.
.
I have the following but it in not calculating the averages correctly, I have uploaded a file with data
Thanks
Sub Avarage_n()
Dim ws As Worksheet
Dim lRow As Long
Set ws = ThisWorkbook.Sheets("Connections")
lRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
With ws.Range("E2:E" & lRow)
.Formula = "=IF(B2<>B1,AVERAGEIFS(B:B,C:C,C2),"""")"
.Value = .Value
End With
End Sub
Bookmarks