+ Reply to Thread
Results 1 to 5 of 5

Using "IF" statement when cell contains key words

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Using "IF" statement when cell contains key words

    Hi guys

    Is is possible to do an "IF" statement to return a value if another cell contains a specific word i.e.

    Lets say A1 contains the sentence "I want to go shopping.

    Could an IF statement be written in B1 that recognises that A1 has the word "shopping" in it and returns a value based on that?

    Cheers

    Mac

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Using "IF" statement when cell contains key words

    Try =if(isnumber(search("shopping",A1)), do_this,do_that)

  3. #3
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Re: Using "IF" statement when cell contains key words

    Hi there

    That works perfectly thank you. Just out of interest is it possible to add a further condition i.e.

    Using my previous example if A1 contains the word "shopping" and A2 is greater than 10 return a value

    I tried =IF(AND(ISNUMBER(SEARCH("shopping",A1),A2>10),"Yes","No")) however, it tells me I have too many arguments.

    Cheers

    Mac

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Using "IF" statement when cell contains key words

    =IF(AND(ISNUMBER(SEARCH("shopping",A1)),A2>10),"Yes","No"))) should do the trick
    Last edited by Pepe Le Mokko; 06-15-2012 at 03:16 PM.

  5. #5
    Registered User
    Join Date
    09-05-2011
    Location
    Ryther, England
    MS-Off Ver
    Office 365
    Posts
    63

    Re: Using "IF" statement when cell contains key words

    Again perfect. Thanks for your help on this. It's really appreciated :-)

+ 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