+ Reply to Thread
Results 1 to 11 of 11

is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

  1. #1
    Registered User
    Join Date
    09-12-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    35

    is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Hello,

    I have a long list of data in column and need to "rewrite" it into column B. For example:

    Column A
    example text
    example writing
    this is an example
    super fun times
    extreme super fun

    and I need to replace anything with "example" in the cell to say "real deal" and anything with "super fun" to moderate fun. I have been using the formula =IF(ISERROR(SEARCH("example",A1)),”no”,”real deal”) but I have to run this multiple times, especially when I have to find and replace loads of different queries. Is it possible to use this formula or a similar one to search for multiple queries and return a different answer depending on the query in the cell?

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Hello Jceg Try this

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5,"super fun","moderate fun"),"example","real deal"),"text","Afraid")

    You can add another substitute and define the word to get converted

    if you are satisfied with the answer click " * " at the left hand corner
    Last edited by hemesh; 09-12-2013 at 06:46 AM.

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Hi,

    Assuming your list of words to be replaced (i.e. "example" and "super fun") is in Sheet2 A1:A2 and the corresponding replacements (i.e. "real deal" and "moderate fun") in Sheet2 B1:B2, and that your list on which you wish to apply these changes is in Sheet1 A1:A5, enter this array (important) formula in Sheet1 B1 and copy down as required:

    =SUBSTITUTE(A1,INDEX(Sheet2!$A$1:$A$2,MATCH(TRUE,ISNUMBER(SEARCH(Sheet2!$A$1:$A$2,Sheet1!A1)),0)),INDEX(Sheet2!$B$1:$B$2,MATCH(TRUE,ISNUMBER(SEARCH(Sheet2!$A$1:$A$2,Sheet1!A1)),0)))

    Edit: note that this will not perform multiple substitutions in the same cell - if an entry contains the strings "example" and "super fun", only one of these (the first) will be replaced. For multiple substitutions, you will need to use a solution such as hemesh's, though this has the disadvantage that, for each desired substitution, an additional SUBSTITUTE function must be added to the original formula.

    However, if you are certain that only one of these strings will ever be present in a given cell, then the solution I propose has the advantage that you can have as many items in your search/replace table as you wish, and as long as you amend the ranges in the formula accordingly, no future amendments need be made.

    Regards
    Last edited by XOR LX; 09-12-2013 at 06:58 AM.
    Click * below if this answer helped

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

  4. #4
    Registered User
    Join Date
    09-12-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Hemesh, thanks for your reply but I realise now I wasn't terribly clear :s. Substitute will replace a string of text if that string exists in the cell, otherwise it returns the contents of the cell unedited. I'm looking for the entire contents of the cell to be edited. For example:

    example text > real deal
    example writing > real deal
    this is an example > real deal
    super fun times > moderate fun
    extreme super fun > moderate fun

    XOR LX thanks for your post but if it's substitute it's not what I'm looking for.

    Apologies for not explaining myself clearer, I hope this clears it up!

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Ah, in that case, and with the same assumptions as in my previous post, all you need is this (non-array, this time) in Sheet1 B1 and copied down:

    =INDEX(Sheet2!$B$1:$B$2,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(Sheet2!$A$1:$A$2,Sheet1!A1)),,),0))

    Regards

  6. #6
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Quote Originally Posted by jceg316 View Post
    =IF(ISERROR(SEARCH("example",A1)),”no”,”real deal”)
    Or replace the "no" part in your formula with a similar IF-statement.

    BTW what if a cell says "super fun example"?
    When I say semicolon, u say comma!

  7. #7
    Registered User
    Join Date
    09-12-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    Quote Originally Posted by L-Drr View Post
    Or replace the "no" part in your formula with a similar IF-statement.

    BTW what if a cell says "super fun example"?
    Would you be able to give me an example please? I've been trying this out but I'm going wrong somewhere and the formula isn't working :S.
    I'm not sure what would happen if the cell says super fun example, in the circumstance I'm using this it's unlikely two text strings I'm searching for will appear in the same cell.

  8. #8
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    this formula checks for both "example" and "super fun":
    =IF(ISNUMBER(FIND("example",A1)),"real deal",IF(ISNUMBER(FIND("super fun",A1)),"moderate fun",""))

  9. #9
    Registered User
    Join Date
    09-12-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    L-Drr thanks for your solution, it's exactly what I'm looking for!

    Thank you everyone else for your help as well.

  10. #10
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    You're welcome!
    Thanks for the rep. Please mark your thread as solved, under Thread Tools above you first post. If this is not possible, post a link to your thread in this topic and a mod will do it for you.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: is it possible to do multiple =IF(ISERROR(SEARCH("example",A1))...

    I've marked this thread as SOLVED for you.
    Next time, select Thread Tools from the links above to mark a thread as SOLVED. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  2. search directory for excel-files and put A136 from tab "1"-"20" in a table
    By Wim_VDW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2012, 10:33 AM
  3. Replies: 0
    Last Post: 03-05-2009, 01:43 PM
  4. [SOLVED] Syntax to "OR" 3 "ISERROR" conditions
    By Mike K in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-22-2006, 11:25 AM
  5. =IF(ISERROR(SEARCH("insurance",A125,1)),"","*")
    By cynichromantique in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-31-2006, 02:45 PM

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