Dim i As Integer, SumCount As Integer
For i = 2 To [a65536].End(xlUp).Row
If Cells(i, 1).Value = TextBox1.Text Then
SumCount = SumCount + Cells(i, 2).Value
End If
Next i
TextBox2.Text = SumCount
图片实在看不成,H!我吧
给你个函数吧
你可以再C2中输入
=SUMPRODUCT(($A$2:$A$8=a2)*($B$2:$B$8))
就得到结果了