Sub sum_up() Dim i As Integer Dim j As Integer Dim l As Integer 'ind7cate last row of the table (data set) Dim k As Double ' To store the values we would like to sum up k = 0 'Give initial values for summing up 'Corresponding the species, this macro sums up regeneration count that were in clumn 35 ' ' Example ' Plot 1 Tree species 1 regeneration count 5 ' Plot 2 Tree sepceis 2 regeneration count 2 ' Plot 3 Tree sepceis 1 regeneration count 1 ' Plot 4 Tree sepceis 2 regeneration count 6 ' ' This macro mames ' Tree speceis 1 count 6 ' Tree species 2 count 8 ' And the results of sum-ups will be listed in "Preparatory" Sheet 'In the current example, there were 58 respondents (farmers) but numbered from 1 to 114 'Each farmer sold their production (rice) for several times (max 8 times) 'Sales were recorded in each time 'We would like to sum up the sales of each farmer 'Data were entered from row 13 to row 476 l = 476 'Data were entered from row 13 to row 476 For i = 1 To 114 For j = 13 To l If Cells(j, 3) = i Then 'Farm ID is in column 3 (C) k = k + Cells(j, 4).Value 'sum up the sales of each round listed in column 4 End If Next j Sheets("Preparatory").Activate Cells(i, 2).Value = i Cells(i, 3).Value = k ' Record the results in Sheets("Base").Activate k = 0 'Free object Next i End Sub