montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 986
- Office Version
- 2010
- Platform
- Windows
VBA Code:
Sub N()
Dim count As Integer
count = 0
For Each cell In Range("B2:F2")
If cell.Value = Range("M2").Value Then
count = count + 1
End If
Next cell
If count = 0 Then
Range("N3").Value = 1
Else
Range("N3").Value = 0
End If
End Sub
I read the range B2:F2 to see if the value on M2 is there or not, so if it is not there count one absent
after suppose I create a loop to go to the next range, but here is the trick if the next range also
do not have this value then now is " 2 times absent count"
but if the next row is present then display 0
sorry the count of two will be display on N2 and the next result "0"
will be display on O2.
I don't have at the moment xxb to display my worksheet my apology for the picture.
this this the partial array
and this is the tiny sample of the output
Thank you for your time