+ Reply to Thread
Results 1 to 4 of 4

How do I use the "or" operator in if statement?

  1. #1
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    How do I use the "or" operator in if statement?

    I'd like to return a value if either "this" or "that" are present in cell a2. I tried:

    if(isnumber(search("this" or "that",a2)),"good",a2)

    but it's not working. What am I doing wrong?
    Last edited by Ocean Zhang; 06-02-2011 at 02:30 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How do I use the "or" operator in if statement?

    How about something like:

    =IF(OR(A2={"This","That"}),"Good","")
    HTH
    Regards, Jeff

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How do I use the "or" operator in if statement?

    XL also has a useful HELP which can be accessed with the F1 key

  4. #4
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How do I use the "or" operator in if statement?

    thanks jeff and arthur!

    Thanks for showing me the {} and the proper formatting. I got this to work:

    =IF(OR(ISNUMBER(SEARCH({"This","That"},A2))),"Good",A2)

+ 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