+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Finding substrings in a string

  1. #1
    Registered User
    Join Date
    12-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Finding substrings in a string

    Hello,

    I want a formula that will look at a string and find one of several possible substrings, then output the matching substring.

    Example:

    String (Column A)

    yellow

    Valid Substrings (Column B)

    llo
    ang
    lue
    re

    The formula should return "llo" for yellow.
    Last edited by kkerr; 12-28-2010 at 03:35 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Finding substrings in a string

    If we assume yellow in A1 and sub strings in B1:B4 then:

    Please Login or Register  to view this content.
    should multiple sub strings be found the above construct will return the last sub string listed found in main string

  3. #3
    Registered User
    Join Date
    12-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Thumbs up Re: Finding substrings in a string

    Awesome! Worked like a dream! Many, many thanks!

  4. #4
    Registered User
    Join Date
    04-12-2012
    Location
    Germany
    MS-Off Ver
    Excel 2008 for the Mac
    Posts
    14

    Re: Finding substrings in a string

    I know this is an old post, but would someone care to explain what happens here? Although it actually works for me in an example worksheet, I need to modify it to adapt it to my needs, and I can't do that without understanding it.

    First, in the documentation I read, SEARCH takes three arguments (text1, text2, start_position), and it looks like text1 is one cell, not a range of cells. When I try the above without embedding it in lookup, all I get is #VALUE...

    Second, lookup is supposed to have two possible types of arguments: either LOOKUP(lookup_value,lookup_vector,result_vector) or LOOKUP(lookup_value,array). Obviously here it must be the 1st, since there are three arguments, but what is this "9.99E+307"? The 1st argument is supposed to be the thing you are looking for. How does "9.99E+307" relate to "yellow" or a substring of it?

    Sorry if I'm being dense...

  5. #5
    Registered User
    Join Date
    04-12-2012
    Location
    Germany
    MS-Off Ver
    Excel 2008 for the Mac
    Posts
    14

    Re: Finding substrings in a string

    [Deleted duplicate post]
    Last edited by Dandy; 06-19-2012 at 12:04 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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