View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Adding values from one table to another

Assuming your 3 columns are A-C, the following will put the count for
the particular combination in a row in column D. Revise 3rd line from
end to put said counts where you want.

Sub macro1()
Dim c As Range
Dim c2 As Range
Dim rng As Range
Dim iEnd As Integer
Dim iCt As Integer

iEnd = Sheets("Sheet1").Range("A1").End(xlDown).Row
Set rng = Sheets("Sheet1").Range("A2:A" & iEnd)
For Each c In rng
iCt = 0
For Each c2 In rng
If c = c2 And c.Offset(0, 1) = c2.Offset(0, 1) And _
c.Offset(0, 2) = c2.Offset(0, 2) Then iCt = iCt + 1
Next c2
c.Offset(0, 3) = iCt
Next c
End Sub

Hth,
Merjet