+ Reply to Thread
Results 1 to 7 of 7

Search for String in Range, If Match, Return Matching Cell Value

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    San Bernardino, CA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Search for String in Range, If Match, Return Matching Cell Value

    I'm having a dog of a time with a formula that will search for string in a range and if a match is found, then return the contents of the cell that matches. For instance in cell B1 if I am searching A1:A3 for the word "Red" then in B1 it would return "Red Apple" since red was found in A2. See small example below:

    Column A Column B

    Blueberry Red Apple
    Red Apple
    Green Apple

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Search for String in Range, If Match, Return Matching Cell Value

    Hi,

    Try the following array formula on your data set. It works for the sample data, you will just need to adjust the ranges to match your actual data:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Remember, this is an array formula, so you will need to use Ctrl + Shift + Enter to confirm it instead of just Enter.

    Hope this helps

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Search for String in Range, If Match, Return Matching Cell Value

    Try

    =INDEX(A:A,MATCH("*Red*",A:A,0))

    OR

    Put the word that you are looking for in a cell-let's say in G1 and then use.

    =INDEX(A:A,MATCH("*"&G1&"*",A:A,0))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Search for String in Range, If Match, Return Matching Cell Value

    Thanks Fotis, I wasn't aware of the use of a wildcard (*) in Excel formulas. I learnt something today!

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Search for String in Range, If Match, Return Matching Cell Value

    ALL of us learning something new every day my friend!

  6. #6
    Registered User
    Join Date
    08-21-2013
    Location
    San Bernardino, CA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Search for String in Range, If Match, Return Matching Cell Value

    Quote Originally Posted by Fotis1991 View Post
    Put the word that you are looking for in a cell-let's say in G1 and then use.

    =INDEX(A:A,MATCH("*"&G1&"*",A:A,0))
    Worked like an absolute charm...I actually needed to look for a specific string length of characters in multiple cells so I altered it a bit and pulled it down to several cells...if anyone is looking for another solution based on specific characters in a cell here is what I came up with thanks to Fotis1991:

    =INDEX(GL$7:GL$2500,MATCH("*"&LEFT(D12,LEN(D12)-7)&"*",GL$7:GL$2500,0))

    Thanks everyone!

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Search for String in Range, If Match, Return Matching Cell Value

    You are welcome and thanks for the feed back.

    It's always very pleasure for me to see someone to use a formula that i suggested in such a cleaver way! Gongr!

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thank you.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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 Range for matching value return and to active cell.
    By morbdetro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2013, 03:08 PM
  2. Search Range for matching value return and to active cell
    By morbdetro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-01-2013, 11:43 AM
  3. [SOLVED] Search for a partial string match and cycle through matching results
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2013, 08:27 AM
  4. Replies: 3
    Last Post: 10-03-2012, 03:09 AM
  5. Search text string for range of text values - return match
    By crugg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2010, 09:55 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