+ Reply to Thread
Results 1 to 7 of 7

Index match with multiple criterias and wildcards (not all criterias always used)

  1. #1
    Registered User
    Join Date
    01-20-2015
    Location
    abc
    MS-Off Ver
    Excel 2017
    Posts
    10

    Index match with multiple criterias and wildcards (not all criterias always used)

    Hello,

    I have a challenge that I have not been able to solve through googling or any other ways. And I am very grateful if someone could help.

    Basically I have 2 outputs from a program (some numbers and a text string). The text string then contains several identification tags. For example the letters CC in one unique place in the string tells you that it is customer Y, XX later in the string tells you that it is a customer buying apples and so on.

    I have then several rules to identify and analyse this data. The data can only get 1 tag, so if I put wildcards on 4 categories and XX in the category that matches where the XX should be in the string to identify apples sales then that means all those strings that have XX in that place should be labelled Apple sales.

    It would have been easy enough if there always was 5 unique tags (as I could combine to a string or use formula in the example spreadsheet), but the issue is that some strings should be labelled only according to 1 or 2 tags, and the rest of the tags should be ignored (I have put * in the example file).

    I have uploaded an example file to identify the issues.

    Thank you in advance for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,215

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Try

    in I3

    =INDEX($I$12:$I$14,MATCH(1,INDEX((IF($D$12:$D$14="*",1,(D3=$D$12:$D$14)))*IF($E$12:$E$14="*",1,(E3=$E$12:$E$14))*IF($F$12:$F$14="*",1,(F3=$F$12:$F$14))*IF($G$12:$G$14="*",1,(G3=$G$12:$G$14))*IF($H$12:$H$14="*",1,(H3=$H$12:$H$14)),0,1),0),0)

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  3. #3
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Hi, to both!

    You could try (NON-CSE):
    [I3] : =INDEX(I$12:I$14,MATCH(5,MMULT(N(COUNTIF(D3:H3,D$12:H$14)>0),{1;1;1;1;1}),))
    And drag it down.

    Blessings!

  4. #4
    Registered User
    Join Date
    01-20-2015
    Location
    abc
    MS-Off Ver
    Excel 2017
    Posts
    10

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Quote Originally Posted by JohnTopley View Post
    Try

    in I3

    =INDEX($I$12:$I$14,MATCH(1,INDEX((IF($D$12:$D$14="*",1,(D3=$D$12:$D$14)))*IF($E$12:$E$14="*",1,(E3=$E$12:$E$14))*IF($F$12:$F$14="*",1,(F3=$F$12:$F$14))*IF($G$12:$G$14="*",1,(G3=$G$12:$G$14))*IF($H$12:$H$14="*",1,(H3=$H$12:$H$14)),0,1),0),0)

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Thank you very much! One question, how do I make the cell references in row 3,4,5,6 follow the formula? Or do I need to enter the array formula 1 by 1 per row?

  5. #5
    Registered User
    Join Date
    01-20-2015
    Location
    abc
    MS-Off Ver
    Excel 2017
    Posts
    10

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Quote Originally Posted by johnmpl View Post
    Hi, to both!

    You could try (NON-CSE):
    [I3] : =INDEX(I$12:I$14,MATCH(5,MMULT(N(COUNTIF(D3:H3,D$12:H$14)>0),{1;1;1;1;1}),))
    And drag it down.

    Blessings!
    Thank you! I get some false positives with this approach, but I see it is because I have some that are only 1 criteria with 4 wildcards, but then another rule can have the same criteria but also another rule. If that is the case it should be another category..
    This is a problem I did not account for in the example. However I have can create a unique string, as I can ignore the wildcards.

    Do you have any insight how this could be solved? Have attached another example file.
    Attached Files Attached Files

  6. #6
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Hi again, dunder!

    Check this new approach (NON - CSE):
    [I3] : =LOOKUP(,0/FREQUENCY(0,1/(1+(MMULT(N(COUNTIF(D3:H3,D$13:H$16)>0),{1;1;1;1;1})=5)*LEN(J$13:J$16))),I$13:I$16)

    or, without taking care about J column (NON - CSE too):
    [I3] : =LOOKUP(,0/FREQUENCY(0,1/(1+(MMULT(N(COUNTIF(D3:H3,D$13:H$16)>0),{1;1;1;1;1})=5)*MMULT(LEN(D$13:H$16),{1;1;1;1;1}))),I$13:I$16)

    Blessings!
    Last edited by johnmpl; 02-23-2018 at 06:20 PM.

  7. #7
    Registered User
    Join Date
    01-20-2015
    Location
    abc
    MS-Off Ver
    Excel 2017
    Posts
    10

    Re: Index match with multiple criterias and wildcards (not all criterias always used)

    Quote Originally Posted by johnmpl View Post
    Hi again, dunder!

    Check this new approach (NON - CSE):
    [I3] : =LOOKUP(,0/FREQUENCY(0,1/(1+(MMULT(N(COUNTIF(D3:H3,D$13:H$16)>0),{1;1;1;1;1})=5)*LEN(J$13:J$16))),I$13:I$16)

    or, without taking care about J column (NON - CSE too):
    [I3] : =LOOKUP(,0/FREQUENCY(0,1/(1+(MMULT(N(COUNTIF(D3:H3,D$13:H$16)>0),{1;1;1;1;1})=5)*MMULT(LEN(D$13:H$16),{1;1;1;1;1}))),I$13:I$16)

    Blessings!
    This is amazing and works perfect! Thank you very much for taking the time to help! Now time to try to understand how the formula works

+ 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. [SOLVED] INDEX MATCH with OR multiple criterias
    By Dahlia in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-24-2017, 11:26 AM
  2. Horizontal Index Match (Hlookup multiple criterias)
    By eyeope in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-05-2017, 05:13 AM
  3. [SOLVED] Index match multiple criterias
    By salimnore in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-27-2015, 07:24 PM
  4. [SOLVED] Index-Match-(or Vlookup) for Multiple criterias.
    By Anatawan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2014, 02:38 AM
  5. [SOLVED] INDEX & MATCH w multiple criterias?
    By Eemmai in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-24-2012, 05:20 AM
  6. INDEX & MATCH, 3 criterias, multiple sheets
    By Jaakkolo in forum Excel General
    Replies: 15
    Last Post: 07-04-2012, 02:16 AM
  7. index match based on multiple criterias
    By jw01 in forum Excel General
    Replies: 4
    Last Post: 09-13-2011, 02:21 PM

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