Forum Discussion
f.gotelli104
Oct 28, 2018Copper Contributor
EXCEL
Hi staff, I had a problem with some formulas on Excel. How can I calculate the frequency of a number in a specific cell in various sheets of a same table? (for example the frequency of number 2 in...
Lorenzo Kim
Oct 29, 2018Bronze Contributor
try this:
Sub CountOccurrenceOf2inB2()
Dim I As Integer
mcnt = 0
For I = 1 To 133
If Worksheets(I).Range("B2") = 2 Then
mcnt = mcnt + 1
End If
Next I
MsgBox "Occurrence for 2 in Cell B2 = " & mcnt
End Sub
HTH
Sub CountOccurrenceOf2inB2()
Dim I As Integer
mcnt = 0
For I = 1 To 133
If Worksheets(I).Range("B2") = 2 Then
mcnt = mcnt + 1
End If
Next I
MsgBox "Occurrence for 2 in Cell B2 = " & mcnt
End Sub
HTH