+ Reply to Thread
Results 1 to 14 of 14

More than one IF condition - does not work...?

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    4

    More than one IF condition - does not work...?

    Hi Everyone,
    I have this function:

    =IF(SEARCH("*equal*";B5);"As per dsign"); IF(SEARCH("*crap*";B5);"works") which displays #VALUE! instead of what i want it to display

    However this =IF(SEARCH("*equal*";B5);"As per dsign") works as it should.

    What am I doing wrong?

    Thanks for help,
    Alex

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: More than one IF condition - does not work...?

    Quote Originally Posted by alexvlad12 View Post
    However this =IF(SEARCH("*equal*";B5);"As per dsign") works as it should.
    Are you sure that works the way you think it does?
    if B5 does NOT contain "equal", then that formula will return #Value!


    Anyway, are you going to expand this to more than just those 2 strings?
    If so, build a table to contain the strings and the results for each string..
    Say E1:F2
    E1:E2 = equal and crap
    F1:F2 = As per dsign and works

    Then use
    =LOOKUP(2^15,SEARCH(E$1:E$2,B5),F$1:F$2)


    There cannot be any blanks in E1:E2


    Note, you'll need to change the , to ; (My machine uses , list seperator)
    Last edited by Jonmo1; 08-27-2013 at 11:04 AM.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: More than one IF condition - does not work...?

    Try it like this:

    =IF(ISNUMBER(SEARCH("*equal*";B5));"As per dsign";IF(ISNUMBER(SEARCH("*crap*";B5));"works";"not_defined"))

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    08-27-2013
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: More than one IF condition - does not work...?

    Hi guys,

    @Jonmo1 - i need to extend this to more than 2 conditions

    @Pete_UK - this displays 'not_defined' for some reason

    Any ideas why?

    Thanks,
    Alex

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: More than one IF condition - does not work...?

    Quote Originally Posted by alexvlad12 View Post
    - this displays 'not_defined' for some reason
    That means that neither of those two words can be found within B5.

    Why don't you try to explain in words what it is that you want to do.

    Pete

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: More than one IF condition - does not work...?

    Did you try my suggestion?


    FYI, the use of the * as a wildcard is unnecessary here.
    That's pretty much the purpose of Search.

  7. #7
    Forum Contributor
    Join Date
    05-07-2013
    Location
    apple valley ca
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: More than one IF condition - does not work...?

    I think i understand what you wrote.. .. Try this. =if(b5="equal","as per design",if(b5="crap","works",""))



    Quote Originally Posted by alexvlad12 View Post
    hi everyone,
    i have this function:

    =if(search("*equal*";b5);"as per dsign"); if(search("*crap*";b5);"works") which displays #value! Instead of what i want it to display

    however this =if(search("*equal*";b5);"as per dsign") works as it should.

    What am i doing wrong?

    Thanks for help,
    alex

  8. #8
    Registered User
    Join Date
    08-27-2013
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: More than one IF condition - does not work...?

    Good morning

    @Jonmo1 - i have a very specific excel file where i can't add anymore extra cells so i can't try your solution
    @Pete - that is impossible, i have checked many times, the words are there.
    @xwarlock10x - this does not work either, error in syntax apparently

    So Pete i have a long list that looks like this:

    Visual Pass Flash content found As per design
    Visual Pass Check that the data collected is the minimal necessary (e.g. if subscribing to email list, don't ask for mobile number). #VALUE!

    To the last column i apply the following formula:
    =IF((SEARCH("*flash*";E250));"As per design";IF((SEARCH("*Check*";E250));"Verified";""))

    and the results are as you see: first one works -> displays As per design and the 2nd doesnt, displays #VALUE!

    What am I doing wrong?

    Thank you
    Alex

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: More than one IF condition - does not work...?

    As Jonmo stated in post #6, you don't need the asterisks with SEARCH, so try it like this:

    =IF(ISNUMBER(SEARCH("flash";E250));"As per design";IF(ISNUMBER(SEARCH("Check";E250));"Verified";""))

    Hope this helps.

    Pete

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: More than one IF condition - does not work...?

    Quote Originally Posted by alexvlad12 View Post
    @Jonmo1 - i have a very specific excel file where i can't add anymore extra cells so i can't try your solution
    That is a big problem then because of this
    Quote Originally Posted by alexvlad12 View Post
    @Jonmo1 - i need to extend this to more than 2 conditions
    If you're extending this out to convert multiple different "key words" to phrases, then the If(ISNUMBER(...) structre is going to get VERY cumbersome.
    I'm surprised that your workbook is so demanding that it can't accomidate a simple lookup table.
    You can even put it in a new sheet, and then HIDE that sheet.

  11. #11
    Registered User
    Join Date
    08-27-2013
    Location
    Warsaw
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: More than one IF condition - does not work...?

    Thank you Everyone!

    @Pete & Jonmo - that worked!

    I'm going to try to add more conditions see, where this breaks.

    SO, say I want to make this more complicated and say if WORD1 but NOT Word2 ... is this even possible?

    Thank you,
    Alex

  12. #12
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: More than one IF condition - does not work...?

    There isn't a BUT function in Excel, so you have to do it like this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    or slightly simpler:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note that ISNUMBER is checking for the presence of word1, ISNA is checking for the absence of word2.

    Hope this helps.

    Pete

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: More than one IF condition - does not work...?

    ISNA wouldn't work because Search returns #Value! when the word isn't found...Not #N/A
    So perhaps ISERROR instead..

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: More than one IF condition - does not work...?

    Thanks, Jonmo - I should have checked !!

    Pete

+ 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: 12
    Last Post: 02-13-2013, 08:39 PM
  2. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 AM
  3. Return Rows whose cell satisy a condition from other Work Sheet
    By antrix in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2009, 03:26 PM
  4. Cant get a forumula to work only if a condition is met.
    By blizzard0c in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-06-2008, 06:20 PM
  5. [SOLVED] if condition is true than send info to another work sheet
    By jwpmann in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2005, 05:05 AM

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