Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to find a value is present in array without looping ?

For i=1 TO ubount(Array)
  Find if value is present

or some more direct statement like

Array.contains(somevalue) like in java
share|improve this question
up vote 1 down vote accepted

Writing your own function to do that really isn't that hard:

Function ARRContainsValue(arrValues() As String, ByVal sValue As String) As Logical

Dim i As Integer

ARRContainsValue = false

    For i = 1 To Ubound(arrValues)
        If arrValues(i) = sValue Then
            ARRContainsValue = true
            Exit Function       
        End if  

End Function

Note that this only works with String based arrays. You would need to write specific functions for each array types (Integer, Date, etc)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.