+ Reply to Thread
Results 1 to 3 of 3

Search for a string of numbers within an array

  1. #1
    Registered User
    Join Date
    02-12-2012
    Location
    White Mountains, NH
    MS-Off Ver
    Excel 2007
    Posts
    65

    Search for a string of numbers within an array

    Hi,
    I'm looking for a way to search for a string of numbers within an array as best I can describe.
    In example; I've go a search string of numbers (will always be 3 or 4 numbers in length) and want to perform a "find" on this search string (say 1-2-3-4) from a group of numbers that spans A1:D60.

    The nuance is that the a match needs to occur if 3-1-2-4 or any variation of the search string is detected in the array.

    The array number strings will also be 3 or 4 numbers in length.

    ALL numbers must be present for a match; so a 4 number search string won't match to a 3 number array string and vice-versa.

    Thank you and regards,
    chubs.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,651

    Re: Search for a string of numbers within an array

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Search for a string of numbers within an array

    You can use the match function in VBa

    Please Login or Register  to view this content.
    With regards your combinations you will have to use a series of loops.

    Please Login or Register  to view this content.
    The above macro created this table :

    1234
    1243
    1342
    1324
    1423
    1432
    2341
    2314
    2413
    2431
    2134
    2143
    3412
    3421
    3124
    3142
    3241
    3214
    4123
    4132
    4231
    4213
    4312
    4321

    When I used the following code at the same position as you need to insert your match.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 09-06-2014 at 10:59 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 12-23-2013, 08:43 AM
  2. Search for a string different sequences same numbers in array
    By ricklou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-19-2012, 10:18 AM
  3. [SOLVED] Test string search in an array
    By weeble33 in forum Excel General
    Replies: 2
    Last Post: 06-19-2012, 12:21 PM
  4. Search and replace(Regex) in string in array.
    By VBABen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2011, 09:21 AM
  5. search for a part of string within an array of strings from another array list
    By jdonohue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2011, 01:32 PM

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