+ Reply to Thread
Results 1 to 5 of 5

multiple if's and case sensitivity

  1. #1
    Registered User
    Join Date
    05-22-2007
    Posts
    2

    multiple if's and case sensitivity

    Scenario:
    - Column A will either contain the text value "yes" or "no"
    - Column B will contain a variety of text in each cell but the specific word I'm interested in amongst the variety of text in each cell will be in all CAPS. The three specific words in CAPS that I'll be looking for are "FEE", "FI", "FO".

    How can I make it so in Column C it displays a value of "5" if "FEE" is in Column B and "yes" in Column A. But a value of "10" if "FI" is in Column B and "yes" in Column A. But a value of "15" if "FO" is in Column B and "yes" in Column A. BUT if "no" is ever in Column A then Column C will always have a value of 0 (zero).

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    See if this gets you there.

    =IF(UPPER(A1)="NO",0,CHOOSE(SEARCH(1,--ISNUMBER(SEARCH("FEE",B1))&--ISNUMBER(SEARCH("FI",B1))&--ISNUMBER(SEARCH("FO",B1))),5,10,15))


    rylo

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    but SEARCH isn't case-sensitive, you need to use FIND, try

    =IF(A1="no",0,IF(A1="yes",LOOKUP(2^15,FIND({"FO","FI","FEE"},B1),{15,10,5}),""))

    Note that this would return #N/A if A1 = yes but none of the criteria are found in B1. To avoid that and give a zero instead

    =IF(A1="no",0,IF(A1="yes",LOOKUP(16,CHOOSE({1,2},0,LOOKUP(2^15,FIND({"FO","FI","FEE"},B1),{15,10,5}))),""))

  4. #4
    Registered User
    Join Date
    05-22-2007
    Posts
    2
    Thanks, between the both of your replies I think I found something I can use. Question about rylo's response.. what does the 1 represent that I bolded below from your reply..

    =IF(UPPER(A1)="NO",0,CHOOSE(SEARCH(1,--ISNUMBER(SEARCH("FEE",B1))&--ISNUMBER(SEARCH("FI",B1))&--ISNUMBER(SEARCH("FO",B1))),5,10,15))

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Apart from confusing the FIND and SEARCH case sensitivity, the section
    --ISNUMBER(SEARCH("FEE",B1))&--ISNUMBER(SEARCH("FI",B1))&--ISNUMBER(SEARCH("FO",B1))
    produces a concatenated result of 1 and 0 (eg 100, 010...). The search of 1 finds the position in the string of the valid result. This is then used in the CHOOSE function to select the relevant return value.


    rylo

+ 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