Checking an array for both InStr and equal to something

  • I have an array of strings that I want to check a variable, strName, against, but for some of the values in the array I just want to see if strName exists anywhere within the array element. For other elements I want to check if strName is equal to the entirety of the array element.


    Do I need 2 arrays, one for the those elements I need to check using InStr and one for those I need to check using equals? Or is there a way of doing this with a single array?


    Thanks


    Also posted here: http://www.mrexcel.com/forum/e…omething.html#post4576931

  • Re: Checking an array for both InStr and equal to something


    Maybe something like this


    The use of CStr() ensures that both text and numeric elements in array x will be checked without error.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!