+ Reply to Thread
Results 1 to 5 of 5

If Statement Based on Text Help!!

  1. #1
    Registered User
    Join Date
    07-08-2012
    Location
    Cherry Hill, NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Exclamation If Statement Based on Text Help!!

    Hello,

    Is there a way to string multiple IF statements based on text?
    For example, I used this formula =IF(ISNUMBER(SEARCH("dog",A1)),"dog","")
    This works for only one of them but what if I wanted it to look for "cat" in A1 and "mouse" in A1 as well and write the corresponding word in another column? (there is no way it could have two out of the three words in the same row, if that is important)

    I've been trying to string it together like this but I keep getting a "#VALUE" error
    =IF(ISNUMBER(SEARCH("dog",A1)),"dog",""),IF(ISNUMBER(SEARCH("cat",A1)),"cat","",IF(ISNUMBER(SEARCH("mouse",A1)),"mouse","")


    Thank you very much if you can contribute any kind of help!!

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: If Statement Based on Text Help!!

    Is this what you mean?

    =IF(ISNUMBER(SEARCH("dog",A1)),"dog","")
    &IF(ISNUMBER(SEARCH("cat",A1)),"cat","")
    &IF(ISNUMBER(SEARCH(" mouse",A1)),"mouse","")

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: If Statement Based on Text Help!!

    Yes, you can do that but the "ISNUMBER" is unnecessary:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    07-08-2012
    Location
    Cherry Hill, NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: If Statement Based on Text Help!!

    Quote Originally Posted by Bob Phillips View Post
    Is this what you mean?

    =IF(ISNUMBER(SEARCH("dog",A1)),"dog","")
    &IF(ISNUMBER(SEARCH("cat",A1)),"cat","")
    &IF(ISNUMBER(SEARCH(" mouse",A1)),"mouse","")
    Hmm, for some reason when I try this, I just get a blank cell...

  5. #5
    Registered User
    Join Date
    07-08-2012
    Location
    Cherry Hill, NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: If Statement Based on Text Help!!

    Quote Originally Posted by Bob Phillips View Post
    Is this what you mean?

    =IF(ISNUMBER(SEARCH("dog",A1)),"dog","")
    &IF(ISNUMBER(SEARCH("cat",A1)),"cat","")
    &IF(ISNUMBER(SEARCH(" mouse",A1)),"mouse","")
    wait!! nevermind! that solved it!! thank you very much!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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