+ Reply to Thread
Results 1 to 3 of 3

Finding the position of a value in an array

  1. #1
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Question Finding the position of a value in an array

    I am aware that you can use Match to find the position of an entry in an array, and the following code works as expected, returning an index of 4:

    Please Login or Register  to view this content.
    The problem is if I don't know the EXACT text that will appear in the array, but only part of it. I am wanting to do something like the VBA .find lookat:=xlpart operation, but on an array rather than a worksheet.
    The following code will return with the "Not Found" message.

    Please Login or Register  to view this content.
    Other than looping through the entire array and doing a Like test on each entry, is there a more elegant (ie. faster) way of searching an array when you only have part of the string?

    Thanks
    Last edited by Phil_V; 06-04-2009 at 06:07 AM.
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,447

    Re: Finding the position of a value in an array

    Add some wildcards.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Finding the position of a value in an array

    Ah! That simple

    I couldn't see anywhere that Index supported wildcards, and then managed to forget to actually try it...

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1