You may try the macros below:
You can change the value in subroutine €śgo_count€ť so that the macro looks
for different values.
Sub go_count()
MsgBox xcount(20)
End Sub
Function xcount(ByVal x)
xcount = 0
Dim cell As Object
For Each cell In Selection.Columns(1).Cells
If cell.Value = x Then
If UCase(cell.Offset(0, 1).Value) = "X" Then
xcount = xcount + 1
End If
End If
Next
End Function
Regards,
Edwin Tam
http://www.vonixx.com
"G" wrote:
Hi The Any assistance will be highly appreciated. I am trying to loop
through a 2D array where it goes through each row. and counts the Xs
corresponding to the value. For example, Ideally 10 should have a count of 2
x's, 14 a cnt of 1 x , 12 0 etc..
10 X
12
14 X
13
10 X
10
Thanks in advance
G