+ Reply to Thread
Results 1 to 10 of 10

Search multiple Text Criteria in one column, and if found, rename it in a different column

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    12

    Search multiple Text Criteria in one column, and if found, rename it in a different column

    I have to search for data in column Y that either contains the text "HYBRID", "GO?????" (the question marks are random numbers or spaces), or "NEP????????LVL3". If it finds HYBRID, it should post "Interconnect" in Column AD. If it find "GO????", it should post "Red" in column AD, and if it finds "NEP????", it should post "Orange" in column AD. All my formulas are created in column AD, but it is searching for the criteria described above from column Y.

    My code is not producing the correct results. It finds HYBRID, but produces an output of RED, not INTERCONNECT. It finds GO????? and NEP?????, but produces an output of INTERCONNECT. What is wrong with this code?

    Please Login or Register  to view this content.
    I'd appreciate some direction and HELP.
    Greg

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    Your code basically says "If it's an error returned when searching for hybrid then return Interconnect otherwise check if an error is returned when Finding GO?????? Return Red etc, remove all the ISERROR parts and see what happens then add one ISERROR at the front of the checks.

  3. #3
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    Hi gbloemke
    You could use a loop like the one below instead of formulas. See what you think
    Cheers

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-08-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    John, your code appears to be working well. I'm not so great at using Dim code, but this will help me learn to understand it better.
    I have one additional question. I like this code that you provided below to include an additional element. I'd like to have it look for the text of "NEP" AND "LVL3". In other words, it must contain both pieces of text to return Orange.

    Please Login or Register  to view this content.
    Possible?
    Thanks,
    Greg

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-08-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    OMG! All works good. Thanks a lot John.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    You're welcome. Glad to help out and thanks for the feedback.

  9. #9
    Registered User
    Join Date
    08-08-2014
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010-2013
    Posts
    31

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    John,

    I was searching for using a Instr VBA code but this works much better for my needs. Question, if I wanted to add a third condition whereas neither of the previous two conditions were met that the cells value is "No" how would I go about doing that? I tried Else but I am still getting the hang of Dim code.

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search multiple Text Criteria in one column, and if found, rename it in a different co

    Maybe:

    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] SumIfs with multiple criteria (search column for cells w/ text containing)
    By jerrydiaz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-22-2013, 01:06 PM
  2. Replies: 0
    Last Post: 03-04-2013, 02:37 PM
  3. Replies: 3
    Last Post: 10-25-2012, 12:49 AM
  4. [SOLVED] search column for text, if found, paste value in a different column in new sheet
    By wkarnadi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2012, 10:29 AM
  5. Search column - return row found in long text string
    By JayL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2005, 12:06 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