+ Reply to Thread
Results 1 to 7 of 7

Find Range of Cells using a Criteria

  1. #1
    Forum Contributor
    Join Date
    04-11-2008
    Location
    Malaysia
    MS-Off Ver
    Office for Mac 2016
    Posts
    138

    Find Range of Cells using a Criteria

    I have this scenario..Im not use if this is possible in excel...

    I have a Range of cells in 1 column..E.g. Below

    A
    B
    B
    B
    A
    A
    B
    B
    A

    It continues on to a few 100k. Now I have a criteria which i will use to search for my range of cells.

    Criteria e.g.
    A
    A
    B
    B

    So i want to search for this particular pattern in my Long list of cells and locate the exact location of the pattern i specify. How can i Do this in Excel...

    Anyone care to shed some light on this.
    Last edited by newbie1234; 12-28-2008 at 12:43 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, This code will search in column "A" for the Pattern you show in your thread:-
    Nb:- If you alter the Pattern, and the new pattern is the same size, you can just alter the Array "Ray". If larger or smaller you will need to alter the Number of "Offsets" in the variable "oVal" and the "resize" number in the address.

    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 12-27-2008 at 11:50 AM.

  3. #3
    Forum Contributor
    Join Date
    04-11-2008
    Location
    Malaysia
    MS-Off Ver
    Office for Mac 2016
    Posts
    138
    Quote Originally Posted by MickG View Post
    Hi, This code will search in column "A" for the Pattern you show in your thread:-
    Nb:- If you alter the Pattern, and the new pattern is the same size, you can just alter the Array "Ray". If larger or smaller you will need to alter the Number of "Offsets" in the variable "oVal" and the "resize" number in the address.

    Please Login or Register  to view this content.
    Regards Mick
    Hi there,

    Thanks for the code..I tried running it under my button event and it works.. Im kinda confused about the altering.. Let say My criteria now is ABBAABB how to i alter the code accordingly? Also the use of Msgbox isnt good sorry for that, since when I have alot of matches it just expands all the way to the bottom and i got no way to scroll..

  4. #4
    Forum Contributor
    Join Date
    10-11-2007
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    251
    Maybe you can use the "String Concatenation" vba function here.

    Then you can use FIND("AABB",A1) to get the start row number of the string criteria "AABB".

  5. #5
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, Try:-
    Data in Column "A".
    Insert Pattern in "B1".
    Results in Column "C"

    Please Login or Register  to view this content.
    Regards Mick

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You could use this function:
    Please Login or Register  to view this content.
    For example,
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Contributor
    Join Date
    04-11-2008
    Location
    Malaysia
    MS-Off Ver
    Office for Mac 2016
    Posts
    138
    Thank You so much everyone for you kind help..

+ 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