+ Reply to Thread
Results 1 to 12 of 12

Search partial text in an array

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Search partial text in an array

    Hello experts

    I have two sheets : Sheet1 & Sheet2
    In Sheet1 : I have data in column B (the search range .. this is the range where I need to search my partial text)
    In Sheet2 : I have in range("E8:G8") some names and under each name there are many partial text for each person

    The expected output would be Sheet1.Column M (As illustrated in the sample workbook)

    The code I need would deal with the data using VBA arrays (not loops at all) as the real data in both Sheet1 & Sheet2 very large
    So I am searching for a code that depend on VBA arrays in storing the data on both sheets and finally put the output in column M

    Thanks advanced for help
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    Try this:
    Please Login or Register  to view this content.
    note:
    in the code above, InStr function use default comparison which is case sensitive. If you want it to be case insensitive then you can replace :
    Please Login or Register  to view this content.
    with:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search partial text in an array

    Mr. Akuini
    Thank you very very very much for this great solution
    It works exactly as I need .. working like charm
    I tested it in the original workbook and it was fascinating
    Best regards

  4. #4
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    Quote Originally Posted by YasserKhalil View Post
    Mr. Akuini
    Thank you very very very much for this great solution
    It works exactly as I need .. working like charm
    I tested it in the original workbook and it was fascinating
    Best regards
    You're welcome & thanks for the feedback.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search partial text in an array

    @Mr. Akuini Sorry for disturbing you again
    I added this text "this is random big city" and run the code and it gives me empty result in column M
    I need to put the text "Out" instead of ""
    I tried this edit
    Please Login or Register  to view this content.
    but doesn't work well

  6. #6
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    Quote Originally Posted by YasserKhalil View Post
    @Mr. Akuini Sorry for disturbing you again
    I added this text "this is random big city" and run the code and it gives me empty result in column M
    I need to put the text "Out" instead of ""
    I tried this edit
    Please Login or Register  to view this content.
    but doesn't work well
    I'm not sure what you want, but maybe this:
    Please Login or Register  to view this content.
    but if what you really want is you add some other 'cities' then you want them be identified as 'out' then you need another code.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search partial text in an array

    Thanks for reply
    Your code is great ..just need instead of empty results to put the text "OUT" instead
    Untitled.png

  8. #8
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    OK, glad to help.

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search partial text in an array

    Thanks for reply
    I still have the problem
    In post # 7 I put an image to illustrate the desired output.. In the yellow cell this is the result when there is no string found, I just need to put the string "OUT" instead of this empty
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    Quote Originally Posted by YasserKhalil View Post
    Thanks for reply
    I still have the problem
    In post # 7 I put an image to illustrate the desired output.. In the yellow cell this is the result when there is no string found, I just need to put the string "OUT" instead of this empty
    Ok, try this:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search partial text in an array

    Mr. Akuini
    Thank you very much for this great and wonderful help
    Now it is perfect for me
    It is working like charm
    Best and kind regards

  12. #12
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Search partial text in an array

    Quote Originally Posted by YasserKhalil View Post
    Mr. Akuini
    Thank you very much for this great and wonderful help
    Now it is perfect for me
    It is working like charm
    Best and kind regards
    You're welcome & thanks for the feedback

+ 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. search partial text
    By shaifshahin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-14-2016, 12:17 PM
  2. search partial text
    By shaifshahin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2016, 06:41 AM
  3. [SOLVED] VLOOKUP HELP! Search for partial text
    By sls1915 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-24-2015, 03:48 PM
  4. [SOLVED] sumif with partial text search
    By etsikhlakis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-15-2014, 03:48 AM
  5. Partial text search
    By dawsexcel in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-23-2014, 12:50 PM
  6. Replies: 4
    Last Post: 07-27-2013, 07:38 AM
  7. Search for Partial Text
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2012, 06:47 AM

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