### Each code line is commented. So its easy to adapt the code for similar tasks

**What it does**

- This VBA macro combines all unique rows in a copied sheet.

It looks at column A values to decide which column is a dublicate
- It sums up the columns B, C, F and H.
- it calculates the average for D, E, G, I and J.

^{It doesn't use a weighted average since I still don't know how exactly you calculate them}

**How to use**

- open your data workbook and press
`ALT`+`F11`
- copy & paste the code below somewhere or in a new modul
- customize
`AVcols()`

and `SUMcols()`

if you want to calculate the sum or average in other columns
- close the VBA editor and select/view the sheet you want to combine
- press
`ALT`+`F8` and execute the macro `combineduplicates`

```
Sub combineduplicates() '### starts our macro
Application.ScreenUpdating = False '### Excel wont update its screen while executing this macro. This is a huge performace boost
Dim AVcols() '### declare an empty array for our average columns
Dim SUMcols() '### declare a second empty array for our sum columns
Dim AVtemp() '### declare a third empty array for our temporal values we need to calculate a weighted average
AVcols() = Array(4, 5, 7, 9, 10) '### we use the first array to store our columns for calculating an average
SUMcols() = Array(2, 3, 6, 8) '### the second array stores the columns which should be summed up
Mcol = 2 '### whats the multiplier column for our weighted average?
ActiveSheet.Copy Before:=Sheets(1) '### take a copy of our activesheet. this way we don't touch the original data
'### the next line sets our range for searching dublicates. Starting at cell A2 and ending at the last used cell in column A
Set searchrange = Range([A2], Columns(1).Find(what:="*", after:=[A1], searchdirection:=xlPrevious))
For Each cell In searchrange '### now we start looping through each cell of our searchrange
ReDim AVtemp(UBound(AVcols) + 1, 0) '### make our temp array 2-dimensional and reser it from the previous loop
For i = 0 To UBound(AVcols) '### save values from start row for average calculating into the temp array
AVtemp(i, UBound(AVtemp, 2)) = CDbl(Cells(cell.Row, AVcols(i))) '### still filling the temp array
Next i '### go ahead to the next column
AVtemp(UBound(AVcols) + 1, UBound(AVtemp, 2)) = CDbl(Cells(cell.Row, Mcol)) '### save the clicks too
Set search = searchrange.Find(cell, after:=cell, lookat:=xlWhole) '### searches for a dublicate. If no dub exists, it finds only itself
Do While search.Address <> cell.Address '### until we find our starting cell again, these rows are all dublicates
For i = 0 To UBound(SUMcols) '### loop through all columns for calculating the sum
'### next line sums up the cell in our starting row and its counterpart in its dublicate row
Cells(cell.Row, SUMcols(i)) = CDbl(Cells(cell.Row, SUMcols(i))) + CDbl(Cells(search.Row, SUMcols(i)))
Next i '### go ahead to the next column
ReDim Preserve AVtemp(UBound(AVcols) + 1, UBound(AVtemp, 2) + 1) '### expand the temp array so we have enough space to fill with values
For i = 0 To UBound(AVcols) '### loop through all columns for calculating the weighted average
'### the next line saves the value in our temp array, but now for the duplicate rows
AVtemp(i, UBound(AVtemp, 2)) = CDbl(Cells(search.Row, AVcols(i)))
Next i '### go ahead to the next column
AVtemp(UBound(AVcols) + 1, UBound(AVtemp, 2)) = CDbl(Cells(search.Row, Mcol)) '### save the clicks too
search.EntireRow.Delete '### we are finished with this row. Delete the whole row
Set search = searchrange.Find(cell, after:=cell) '### and search the next dublicate after our starting row
Loop
If search.Row = cell.Row Then '### ok, now we have to calculate the average. All needed values are temporarly stored in our temp array
For i = 0 To UBound(AVcols) '### start with looping through all average columns
average = 0 '### reset the variable from the last loop
For j = 0 To UBound(AVtemp, 2) '### start looping through the data from all dublicated rows
clicks = AVtemp(UBound(AVcols) + 1, j) '### take the clicks for that row from the array
sumclicks = Cells(cell.Row, Mcol) '### take the summed up clicks for all dublicated rows
addaverage = AVtemp(i, j) '### take the value which should be multiplied
average = average + (clicks / sumclicks * addaverage) '### now calculate the weighted average and sum it up with the old one
Next j '### goto next data of dublicate rows
Cells(cell.Row, AVcols(i)) = average '### when finished with calculating, write the result to the workbook
Next i '### go ahead to the next average column
End If '### only the end line of our condition
Next '### from here we start over with the next cell of our searchrange
'### Note: This is a NEW unique value since we already deleted all old dublicates
Application.ScreenUpdating = True '### re-enable our screen updating
End Sub '### ends our macro
```

Have a look at my test workbook if you have trouble to start the macro.