+ Reply to Thread
Results 1 to 9 of 9

Cannot get Index Match to work with 2 matches and a specific criteria

  1. #1
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Cannot get Index Match to work with 2 matches and a specific criteria

    Hello All,

    See attached. In Sheet3, Column BC, I am trying to input a formula that will return the value in Sheet2 column J based on the following match:

    Sheet3 column K matches Sheet2 column F
    Sheet3 column CD matches Sheet2 column B

    After making those matches, the formula has to find the string "CONLAB" in Sheet2 column G. After all of this logic, the data from Sheet 2 column J should now appear in Sheet3 column BC.

    Does this make sense
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    The normal INDEX/MATCH syntax to one range, the inner MATCH() range must be replaced with an INNER INDEX() that merges the two search columns into a single searchable text string. Like so:

    =INDEX(Sheet2!$J$1:$J$1000, MATCH($K2 & "-" & $CD2, INDEX(Sheet2!$F$1:$F$1000 & "-" & Sheet2!$B$1:$B$1000, 0), 0))

    This is for 1000 rows of data, only expand that as far as you actually need.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    Quote Originally Posted by JBeaucaire View Post
    The normal INDEX/MATCH syntax to one range, the inner MATCH() range must be replaced with an INNER INDEX() that merges the two search columns into a single searchable text string. Like so:

    =INDEX(Sheet2!$J$1:$J$1000, MATCH($K2 & "-" & $CD2, INDEX(Sheet2!$F$1:$F$1000 & "-" & Sheet2!$B$1:$B$1000, 0), 0))

    This is for 1000 rows of data, only expand that as far as you actually need.
    Thank you. I think I've got that part. Now I am struggling to get the formula to only return a value if it finds the string "CONLAB" in column G of sheet 2.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    You expand from INDEX of two columns to index of 3.

    =INDEX(Sheet2!$J$1:$J$1000, MATCH($K3 & "-" & $CD3 & "-CONLAB", INDEX(Sheet2!$F$1:$F$1000 & "-" & Sheet2!$B$1:$B$1000 & "-" & Sheet2!$G$1:$G$1000, 0), 0))
    Last edited by JBeaucaire; 01-28-2017 at 08:54 PM.

  5. #5
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    Quote Originally Posted by JBeaucaire View Post
    You expand from INDEX of two columns to index of 3.

    =INDEX(Sheet2!$J$1:$J$1000, MATCH($K3 & "-" & $CD3 & "-CONLAB", INDEX(Sheet2!$F$1:$F$1000 & "-" & Sheet2!$B$1:$B$1000 & "-" & Sheet2!$G$1:$G$1000, 0), 0))
    Thank you. I am going to practice this! SOLVED!

  6. #6
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    Hello All,

    See attached. See Sheet 3. Column BC has a formula that searches Sheet2 and returns data.

    I've added two more caveats. I need the formula to not only search for "CONLAB". I need it to search for "CONLAB" "FULLSC" and "INST". If it finds one of these three for the corresponding site ID, it should return that PID in Sheet2 Column G. If it finds one or more like on sheet2 rows 8 and 9, it should return the word "duplicate".

    Let me know if that makes sense.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    BumpageBumpage

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    Once you start getting that many criteria, it might be better to add a helper column to test for all of those, and based on that test, either create a unique reference number (which would eliminate the need for an array formula) or return TRUE or FALSE, then use that in Jerry's suggestion.

    I used column K for the helper...
    K2=IF(OR(G2="CONLAB",G2="FULLSC",G2="INST"),K1+1,K1)
    copied down

    Then for the extract...
    =IFERROR(INDEX(Sheet2!$J$1:$J$1000,MATCH(ROW(1:1),Sheet2!$K$1:$K$1000,0)),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  9. #9
    Forum Contributor
    Join Date
    09-21-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    449

    Re: Cannot get Index Match to work with 2 matches and a specific criteria

    Quote Originally Posted by FDibbins View Post
    Once you start getting that many criteria, it might be better to add a helper column to test for all of those, and based on that test, either create a unique reference number (which would eliminate the need for an array formula) or return TRUE or FALSE, then use that in Jerry's suggestion.

    I used column K for the helper...
    K2=IF(OR(G2="CONLAB",G2="FULLSC",G2="INST"),K1+1,K1)
    copied down

    Then for the extract...
    =IFERROR(INDEX(Sheet2!$J$1:$J$1000,MATCH(ROW(1:1),Sheet2!$K$1:$K$1000,0)),"")
    Sorry FDibbins. It is hard to understand my directions.

    So for site # 95217373, it should have returned the word "Duplicate" in cell BC7 because the site has two PID's listed.

    Also, it doesn't appear that the formula you gave with the helper column is returning the right R in column J of sheet2.

+ 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 2-3 Matches or Criteria
    By TreeLife in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-21-2016, 09:27 PM
  2. Replies: 4
    Last Post: 04-27-2015, 02:42 PM
  3. Replies: 0
    Last Post: 05-22-2014, 04:17 AM
  4. [SOLVED] Array index with 3 way match criteria of 2 rows and 1 column cant get to work!
    By volchik696 in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 01-20-2014, 06:18 AM
  5. Replies: 6
    Last Post: 04-12-2013, 05:50 AM
  6. [SOLVED] INDEX MATCH array formula that matches substring n gives multiple matches
    By bkwins in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2013, 04:57 AM
  7. Replies: 4
    Last Post: 07-18-2012, 02:34 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