+ Reply to Thread
Results 1 to 6 of 6

Search for text and then write value to a cell?

  1. #1
    Registered User
    Join Date
    08-03-2010
    Location
    Oakland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Search for text and then write value to a cell?

    I need to read column and cell A1.
    I am searching for a text string. In this case "Acme Inc."
    Acme Inc. can be at the beginning, middle or end of the string I am searching.
    Acme Inc. can have text before or after it in the string.
    Once Acme. Inc. has been found I then want Acme Inc. written to column and cell H1
    Then repeart for all of colunm A

    I have been trying to use vLookup but with no luck. Here is my syntax.

    =VLOOKUP("Acme Inc.",A1:A10,1)

    How do I find my text string?
    Then, how do I write it to another cell?

    Thanks to anyone who can help.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Search for text and then write value to a cell?

    Maybe you mean?

    =IF(Isnumber(search("Acme Inc.",A1)),"Acme Inc.","")

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    08-03-2010
    Location
    Oakland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Search for text and then write value to a cell?

    Quote Originally Posted by NBVC View Post
    Maybe you mean?

    =IF(Isnumber(search("Acme Inc.",A1)),"Acme Inc.","")

    copied down
    Well that does not generate any syntax errors but it also displays nothing. I am new to Excel coding so sorry for newbie questions. How do I use your code, display the contents and then write the Acme Inc. value to a new cell?

    Thanks!!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Search for text and then write value to a cell?

    That is a formula that you would but, in say cell H1, and it looks in the text string that is in A1 and tries to find the exact string: "Acme Inc." (period included). If it does not find that exact string, it returns a blank.. otherwise it returns the text "Acme Inc."

    You can remove the period if you want to ignore if a period might exist or not in the search string

  5. #5
    Registered User
    Join Date
    08-03-2010
    Location
    Oakland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Search for text and then write value to a cell?

    Quote Originally Posted by NBVC View Post
    That is a formula that you would but, in say cell H1, and it looks in the text string that is in A1 and tries to find the exact string: "Acme Inc." (period included). If it does not find that exact string, it returns a blank.. otherwise it returns the text "Acme Inc."

    You can remove the period if you want to ignore if a period might exist or not in the search string
    Cool......got it. Yes, it does work. Thank you !!!!!

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Search for text and then write value to a cell?

    Possibly reading your question a slightly different way?

    In H1
    =IF(ISNUMBER(SEARCH($A$1,A1)),$A$1,"")
    Drag/Fill Down

    Where the text string you want to match is in A1

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ 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