+ Reply to Thread
Results 1 to 7 of 7

Find a string withing cell range and return cell number

  1. #1
    Registered User
    Join Date
    05-14-2010
    Location
    Plovdiv, Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    3

    Find a string withing cell range and return cell number

    Hi,

    I have a column "A" with many alphanumeric values.
    How to find a specific string (only one in the range) and to return the cell number where the string is located?

    see the example example (the string is "red"):
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    08-29-2007
    Posts
    47

    Re: Find a string withing cell range and return cell number

    Here you go. Simply replace "red" with a different string, or reference to another cell, and update the ranges to where you want it to search!

    Please Login or Register  to view this content.
    You'll need to array enter once you type in the formula - usually CTRL+SHIFT+ENTER.

    Note: If there's more than one "red" - it will return the bottom-most row. If it's not in that row, it will return a 0.

    Note 2: If you want it to be case-sensitive, change "SEARCH" to "FIND"

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

    Re: Find a string withing cell range and return cell number

    Perhaps

    =MATCH("*red*",A1:A5,0)

    Note however that in the above (and indeed the prior array) should the keyword be embedded (eg "hundred") then it follows that this particular approach is open to error.

    Based on your sample you can avoid this by replacing commas and period delimiters with spaces such that you have a common delimiter (and therefore normalised strings), at which point:

    =LOOKUP(9.99E+307,SEARCH(" red "," "&SUBSTITUTE(SUBSTITUTE(A1:A5,","," "),"."," ")&" "),ROW(A1:A5))

    should do what you want.

    Note: that both this and the above shall return #N/A if not found (rather than 0 per the Array) - this can of course be catered for as per your preference.

  4. #4
    Registered User
    Join Date
    05-14-2010
    Location
    Plovdiv, Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find a string withing cell range and return cell number

    Thanks! It works fine.

  5. #5
    Registered User
    Join Date
    05-14-2010
    Location
    Plovdiv, Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find a string withing cell range and return cell number

    It works...thank you!

  6. #6
    Registered User
    Join Date
    03-16-2015
    Location
    London, ENgland
    MS-Off Ver
    2007
    Posts
    6

    Re: Find a string withing cell range and return cell number

    I am trying to apply this to a similar situation without success. For example I want to know if the contents of each cell in column A. (e.g.A. Noble & Son) exist as a substring anywhere in column E. Match does not have to be case sensitive. Justa simple yes/NO, 1/0 answer will do. Any ideas? Thanks.

    Excel snap.jpg

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,601

    Re: Find a string withing cell range and return cell number

    paulwenman,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ 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