+ Reply to Thread
Results 1 to 3 of 3

VBA Find Partial String in String Array and Output the Found String Array Value

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    9

    VBA Find Partial String in String Array and Output the Found String Array Value

    Okay, so I am trying to do a sort of index match thing using VBA. What I am attempting to do is to use the prefix of a long number and try to find that exact prefix in a string array, and output that string array value. So this is what I have so far as a test:

    Please Login or Register  to view this content.
    So I can match the text exactly so if I put PREFIXB in cell A1 in this example, i will get the msg box saying "YES", but if I make it PREFIXB1231k4j3jj1kj32cj, it will display "NO". I want to get it so that PREFIXB will be displayed in the cell that I put the formula in. So if A1 = "PREFIX1AAA100CF" and cell B1 = "=ABC(A1)", cell B1 will display "PREFIX1AAA".

    Now the thing is that these prefixes can have different lengths, but will never encompass the exact prefix of another. So if I had a prefix of: PRE1AB, I won't have a prefix of PRE1A.

    Thanks for any help!

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA Find Partial String in String Array and Output the Found String Array Value

    How is the input parameter s being used??
    Gary's Student

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: VBA Find Partial String in String Array and Output the Found String Array Value

    I am not really using s as an input parameter for this code. For some reason the code only works with (s as string) in there. I came up with my own solution to this problem (any input/advice would be appreciated); however, it isn't very elegant:

    Please Login or Register  to view this content.

+ 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. [SOLVED] Trying to match partial string to an array, need to output related cell
    By vijaijohn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2013, 03:04 PM
  2. [SOLVED] Partial Match Cell To String Array
    By amazinglazers in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-09-2013, 05:56 AM
  3. [SOLVED] problem finding string using .find method when string to be found contains ~ (a tilde)
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 07:38 AM
  4. [SOLVED] Vlookup, Match (Search or Find) partial string within string in a Cell
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2013, 12:40 PM
  5. [SOLVED] Return matching string in array if cell contains string contained in the array
    By AaronsZ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2013, 01:55 PM

Tags for this Thread

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