使用此:
=COUNTIF(A:A,3)-COUNTIFS(A1:A1040000,3,A2:A1040001,3)
编辑:
以下公式也适用:
=COUNTIFS(A1:A1040000,3,A2:A1040001,"<>" & 3)
在vba中:
Dim output as Long
With AcitveSheet
output = Application.WorksheetFunction.Countifs(.Range("A1:A1040000"),3,.Range(A2:A1040001),"<>" & 3)
End With
Debug.Print output