+ Reply to Thread
Results 1 to 12 of 12

Help with IF OR Formula

  1. #1
    Registered User
    Join Date
    11-17-2010
    Location
    Westbrook, Maine
    MS-Off Ver
    Excel 2007
    Posts
    15

    Help with IF OR Formula

    Help! I am brand new to writing formulas, and I cannot seem to get this one to work.

    Here is what I am trying to do:

    If cell J2 contains "Apple" or "Banana", populate value of cell K2.

    I can get them to work separately:
    =IF(ISNUMBER(SEARCH("Apple",J2)),K2)
    =IF(ISNUMBER(SEARCH("Banana",J2)),K2)

    I cannot get them to work together. Here is what I had so far, but clearly I am doing something wrong.

    =IF(OR(ISNUMBER(SEARCH("Apple",J2)),K2), IF(ISNUMBER(SEARCH("Banana",J2)),K2))

    Any help is appreciated... Explanations are great, I want to learn so I can stop bugging you guys!

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Help with IF OR Formula

    Try this

    =IF(COUNT(SEARCH({"Apple","Banana",J2)),K2)
    Audere est facere

  3. #3
    Registered User
    Join Date
    11-17-2010
    Location
    Westbrook, Maine
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Help with IF OR Formula

    I received an error message that said "The formula you typed contains an error." I tried switching the { to a (, but I still got the message.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with IF OR Formula

    I think daddylonglegs just left out a }

    =IF(COUNT(SEARCH({"Apple","Banana"},J2)),K2)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Registered User
    Join Date
    11-17-2010
    Location
    Westbrook, Maine
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Help with IF OR Formula

    Quote Originally Posted by NBVC View Post
    I think daddylonglegs just left out a }

    =IF(COUNT(SEARCH({"Apple","Banana"},J2)),K2)
    Thank you for looking! This one went without the error, but I am still getting a FALSE where I should be getting data. Some of the values in column K are numeric. Would that change things?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with IF OR Formula

    FALSE means that Apple or Banana doesn't exist in J2....

    If that is true and you want a blank returned instead of FALSE then try:

    =IF(COUNT(SEARCH({"Apple","Banana"},J2)),K2,"")

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Help with IF OR Formula

    Quote Originally Posted by daddylonglegs View Post
    Try this

    =IF(COUNT(SEARCH({"Apple","Banana",J2)),K2)
    That one needed some work..... Thanks NBVC

  8. #8
    Registered User
    Join Date
    11-17-2010
    Location
    Westbrook, Maine
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Help with IF OR Formula

    I apologize, I must not have explained this clearly.

    I am pasting the formula in cell L2. So basically, if column J2 says "Apple" or "Banana", I need the value from K2 to be populate in L2.

    So for example... if J2 says "Apple" and K2 says "12", L2 should say "12".

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Help with IF OR Formula

    The last version that NBVC posted should work correctly, i.e. in L2

    =IF(COUNT(SEARCH({"Apple","Banana"},J2)),K2,"")

    If J2 contains "Apple" or "Banana" that give you the value from K2, otherwise you get a blank

  10. #10
    Registered User
    Join Date
    11-17-2010
    Location
    Westbrook, Maine
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Help with IF OR Formula

    Quote Originally Posted by daddylonglegs View Post
    The last version that NBVC posted should work correctly, i.e. in L2

    =IF(COUNT(SEARCH({"Apple","Banana"},J2)),K2,"")

    If J2 contains "Apple" or "Banana" that give you the value from K2, otherwise you get a blank
    IT WORKED!!! Thank you so much!

  11. #11
    Registered User
    Join Date
    10-26-2011
    Location
    Chittagong, Bangladesh
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Help with IF OR Formula

    Please give me a formula

    Slave----------Rate-----Income-----Tax

    1st---------------Nil-----200,000--------Nil
    Next------------10%---300,000----30,000
    Next------------15%---400,000----60,000
    Next------------20%---300,000----60,000
    Next on wards 25%
    (On any amount)
    Last edited by nafis_3510; 10-26-2011 at 03:25 AM.

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with IF OR Formula

    Welcome,

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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