matching duplicates then looking up corresponding amounts
Hi,
put this code in a module and save it as an *.xla.
Function vertSUM(aTable As Range, aCell As Range) As double
Dim tmp As Range
Dim A As Integer
Set tmp = aTable.Find(aCell.Text, LookIn:=xlValues)
If Not tmp Is Nothing Then
A = tmp.Row
Do
vertSUM = vertSUM + tmp.Offset(, 1).Value
Set tmp = aTable.Find(aCell.Text, tmp, LookIn:=xlValues)
If tmp Is Nothing Then Exit Function
Loop While tmp.Row < A
End If
End Function
let me know,
Regards,
stefano
|