+ Reply to Thread
Results 1 to 14 of 14

How to satisfy multiple conditions using multiple criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    10-16-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Question How to satisfy multiple conditions using multiple criteria

    Hi everyone

    I'm trying to divide my data into 6 different groups, based on 2 different criteria. First, I am not sure how to write the logical test to take 2 columns of data into consideration (using "&" and "AND" do not work; I am not sure what else to try), and second I can't figure out how to write the formula so that it can select from 1 of 6 conditions.

    So, overall here is what I want:

    If DL2=3 and CK2=1, then I want this to be labeled as '1'
    If DL2=3 and CK2=2, 2
    If DL2=1 and CK2=2, 3
    If DL2=2 and CK2=2, 4
    If DL2=1 and CK2=1, 5
    If DL2=2 and CK2=1, 6

    These 6 conditions cover all possible combinations of numbers in the two columns.

    Any help in mashing all this into one beautiful formula would be greatly appreciated!
    Last edited by binkatron5000; 10-16-2009 at 06:58 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to satisfy multiple conditions using multiple criteria

    Perhaps

    =MATCH(DL2+(CK2/10),{3.1,3.2,1.2,2.2,1.1,2.1},0)

  3. #3
    Registered User
    Join Date
    10-16-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Thumbs up Re: How to satisfy multiple conditions using multiple criteria

    Wow, the "match" function is new to me! I am not certain how to interpret the formula but it works wonderfully

    Thank you so much!!!

  4. #4
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: How to satisfy multiple conditions using multiple criteria

    Ok...there maybe a better way do this .. maybe sumproduct, but here is something

    Nested IF with AND

    I have used A's and B's instead of your DL's and CK's...easy to transpose.


    =IF(AND(A1=3,B1=1),1,IF(AND(A1=3,B1=2),2,IF(AND(A1=1,B1=2),3,IF(AND(A1=2,B1=2),4,IF(AND(A1=1,B1=1),5,IF(AND(A1=2,B1=1),6))))))

  5. #5
    Registered User
    Join Date
    10-16-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to satisfy multiple conditions using multiple criteria

    lol

    jj72uk, this is kind of how I pictured it but I just couldn't make it work. Putting the "AND" in front, derp I should have thought of that

    Thanks for the suggestion; If I ever need to do something similar to this again and can't work out Donkey's method then yours should be fine :D

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to satisfy multiple conditions using multiple criteria

    The match method makes use of the fact the source values are numbers, range is known and each combination can be made to be unique

    DL2=3 and CK2=1 --> 3 + 1/10 -> 3.1
    DL2=3 and CK2=2 --> 3 + 2/10 -> 3.2
    DL2=1 and CK2=2 --> 1 + 2/10 -> 1.2
    DL2=2 and CK2=2 --> 2 + 2/10 -> 2.2
    DL2=1 and CK2=1 --> 1 + 1/10 -> 1.1
    DL2=2 and CK2=1 --> 2 + 1/10 -> 2.1

    You can then match the current value against these 6, the MATCH will return the position of the MATCH within the array of values, so

    =MATCH(DL2+(CK2/10),{3.1,3.2,1.2,2.2,1.1,2.1},0)

    will return the position that DL2+(CK2/10) is found... by ordering the values in the inline array correctly you will get the appropriate 1-6 return.

  7. #7
    Registered User
    Join Date
    10-16-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to satisfy multiple conditions using multiple criteria

    Thanks for explaining this, I think it makes sense

    Guess we'll find out if I truly get it next time I try to use it :P

  8. #8
    Registered User
    Join Date
    10-16-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to satisfy multiple conditions using multiple criteria

    Hi again,

    Just to clarify: from what I understand, dividing the second number by 10 is used to make each combination total a unique number? So, theoretically you could use any number besides 10?

    Edit: Hmm looking at it again maybe I am way off. It's just the /10 that I am not clear on its purpose
    Last edited by binkatron5000; 10-16-2009 at 04:04 PM.

  9. #9
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: How to satisfy multiple conditions using multiple criteria

    :p see i knew there was a better way

  10. #10
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: How to satisfy multiple conditions using multiple criteria

    Donkeys is cleaner and better :P learn his!!!

+ 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