+ Reply to Thread
Results 1 to 13 of 13

Multiple criteria match to return adjacent cell value

  1. #1
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Multiple criteria match to return adjacent cell value

    Hello everyone,

    I've been banging my head against the wall for days trying to figure out the best way to accomplish this task.

    I have two sets of data that partially contain information that I need to query to return data from one of the sheets.

    Example:
    - Sheet 1 lists computers by make/model/designation, each in a unique, separate column. Some have data in all 3 columns, some only in 2.
    - Sheet 2 lists support options for computers based on make/model/designation, again, each in a unique, separate column, and with Support in a 4th column.

    Objective:
    I am trying to run a query against a large set of data that matches Make column, Model column, Designation columns, then returns the Support column.

    So far, I've been mostly dead in the water. I'm not sure if I need to be doing an INDEX and a MATCH, or an IF with a nested MATCH... and I have no idea how do have it return the Support cell value based on the other criteria being met.

    Sheet 1 Might look like:

    Make | Model | Designation
    Dell | 5600 | P4
    HP | 9000 | P3
    Dell | 5600 | P2
    Acer | 300 | P4
    (continue for 2000 rows)

    Sheet 2 might look like:

    Make | Model | Designation | Supported
    Dell | 5600 | P4 | Yes
    Dell | 5600 | P2 | No
    HP | 9000 | P3 | Yes
    HP | 8000 | P2 | No
    Acer | 300 | P4 | Yes

    This support matrix is about 48 rows, and contains all support yes/no for all models. I am trying to apply it to the 2000 rows of assets listed in inventory.

    The result that I'm looking for is that when there is an exact match of Make/Model/Designation on both sheets, that the support yes/no is returned in Sheet 1.

    Any help would be greatly appreciated, and may save me from a heart attack.

    Thank you!

  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,193

    Re: Multiple criteria match to return adjacent cell value

    Try

    on Sheet1 D2

    =IFERROR(INDEX(Sheet2!$D$2:$D$50,MATCH(1,(Sheet2!A2:A50=$A2)*(Sheet2!B2:B50=$B2)*(Sheet2!C2:C50=$C2),0)),"")

    Enter with Ctrl+shift+EnterCopy down
    Last edited by JohnTopley; 02-02-2016 at 03:52 PM. Reason: Added IFERROR

  3. #3
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Re: Multiple criteria match to return adjacent cell value

    Quote Originally Posted by JohnTopley View Post
    Try

    on Sheet1 D2

    =IFERROR(INDEX(Sheet2!$D$2:$D$50,MATCH(1,(Sheet2!A2:A50=$A2)*(Sheet2!B2:B50=$B2)*(Sheet2!C2:C50=$C2),0)),"")

    Enter with Ctrl+shift+EnterCopy down
    Thank you for the help! I'm getting close.

    I took the string you provided and tested it in a simple spreadsheets with the example I gave above. With some tweaks, I was able to get it returning as hoped.

    However... When I tried to apply it to the data that I am hoping to use it with, I am getting a small error.

    Here is the modified string... =IFERROR(INDEX('Supp YN'!$E$2:$E$48,MATCH(1,('Supp YN'!$A$1:$A$48=L13)*('Supp YN'!$B$1:$B$48=M13)*('Supp YN'!$C$1:$C$48=N13),0)),"No Match")

    It is returning data, but is one cell off. For example, if the match function finds all the criteria met on SuppYN!A5, B5, C5 it is returning a value of E6 instead of the desired E5.

    I've been looking, but am not seeing what is the issue.

    Suggestions?

    Thank you,
    Adam

  4. #4
    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,193

    Re: Multiple criteria match to return adjacent cell value

    =IFERROR(INDEX('Supp YN'!$E$2:$E$48,MATCH(1,('Supp YN'!$A$2:$A$48=L13)*('Supp YN'!$B$2:$B$48=M13)*('Supp YN'!$C$2:$C$48=N13),0)),"No Match")

    Change the range is indicated by the red .

  5. #5
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Re: Multiple criteria match to return adjacent cell value

    The range is the search range for the match function, though. Correct?

    What I attempted to do was set the range set with static values to query a reference table of make/model/designation/support in Sheet 2.

    Sheet1 looks for a match in that table based on multiple criteria and returns the support value associated.

    Right now it is doing the match, but it is returning a value that is one row down.

  6. #6
    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,929

    Re: Multiple criteria match to return adjacent cell value

    What John was trying to show you is that all the ranges in the MATCH, need to - well - match, they all need to be the same size.

    Which row does your "MATCH" data start in, and which row does the INDEX data start in?
    Keep in mind that the MATCH will return a row number - that number is what the INDEX is using to return the answer
    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

  7. #7
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Re: Multiple criteria match to return adjacent cell value

    Quote Originally Posted by Adam859 View Post
    Hello everyone,

    I've been banging my head against the wall for days trying to figure out the best way to accomplish this task.

    I have two sets of data that partially contain information that I need to query to return data from one of the sheets.

    Example:
    - Sheet 1 lists computers by make/model/designation, each in a unique, separate column. Some have data in all 3 columns, some only in 2.
    - Sheet 2 lists support options for computers based on make/model/designation, again, each in a unique, separate column, and with Support in a 4th column.

    Objective:
    I am trying to run a query against a large set of data that matches Make column, Model column, Designation columns, then returns the Support column.

    So far, I've been mostly dead in the water. I'm not sure if I need to be doing an INDEX and a MATCH, or an IF with a nested MATCH... and I have no idea how do have it return the Support cell value based on the other criteria being met.

    Sheet 1 Might look like:

    Make | Model | Designation
    Dell | 5600 | P4
    HP | 9000 | P3
    Dell | 5600 | P2
    Acer | 300 | P4
    (continue for 2000 rows)

    Sheet 2 might look like:

    Make | Model | Designation | Supported
    Dell | 5600 | P4 | Yes
    Dell | 5600 | P2 | No
    HP | 9000 | P3 | Yes
    HP | 8000 | P2 | No
    Acer | 300 | P4 | Yes

    This support matrix is about 48 rows, and contains all support yes/no for all models. I am trying to apply it to the 2000 rows of assets listed in inventory.

    The result that I'm looking for is that when there is an exact match of Make/Model/Designation on both sheets, that the support yes/no is returned in Sheet 1.

    Any help would be greatly appreciated, and may save me from a heart attack.

    Thank you!

    As in the example above, the lookup table is on Supp YN, which in that example is Sheet 2.

    Sheet 1 is a worksheet that is 2000 lines long, and I am matching criteria from columns L, M, N against columns A, B, C in Sheet 2, and if they match, returning a value into Sheet 1 column O from Sheet 2 column E.

    My understanding is that the MATCH function looks at L2, M2, N2 in Sheet 1, then compares it to a table that is being indexed in Sheet 2.

    Am I explaining poorly? If so, I apologize. I am learning as I go

  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,929

    Re: Multiple criteria match to return adjacent cell value

    Based on your example...
    Sheet1...
    A
    B
    C
    D
    1
    Make Model Designation
    2
    Dell
    5600
    P4 Yes
    3
    HP
    9000
    P3 Yes
    4
    Dell
    5600
    P2 No
    5
    Acer
    300
    P4 Yes

    D2=INDEX(Sheet2!$D$2:$D$20,MATCH(Sheet1!A2&Sheet1!B2&Sheet1!C2,INDEX(Sheet2!$A$2:$A$20&Sheet2!$B$2:$B$20&Sheet2!$C$2:$C$20,0),0))

    Sheet2...
    A
    B
    C
    D
    1
    Make Model Designation Supported
    2
    Dell
    5600
    P4 Yes
    3
    Dell
    5600
    P2 No
    4
    HP
    9000
    P3 Yes
    5
    HP
    8000
    P2 No
    6
    Acer
    300
    P4 Yes


    Also, it is not necessary to quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

  9. #9
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7
    I'm sorry. I'm missing the whatever may be causing the functions to return data that is consistently one cell off.

  10. #10
    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,929

    Re: Multiple criteria match to return adjacent cell value

    upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

  11. #11
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Re: Multiple criteria match to return adjacent cell value

    I'm on a work system and company policy doesn't allow exporting of any data, so I cannot upload any file.

    I do appreciate your offer to look at.

    Perhaps I am explaining it poorly, but it is as I've said above.

    Sheet 2 (Supp YN) contains reference data in columns A, B, C, and a Support in column E.

    Data in each column begins at row 2 and ends at row 48.

    Data in Sheet 1 begins at row 2 and ends around 2000

    Data in Sheet 1 that I am attempting to match against Sheet 2 is in columns L, M, N

    Sheet 1 has a blank column, column O, which I am attempting to fill with return data from Sheet 2 column E when a match is found.

    Currently the matching seems to be working. For example, it is matching against make, model, designation (columns L, M, N, respectively, in Sheet 1)

    However, the return data is coming back incorrectly, but only by one cell down from Sheet 2 column E.

    For example, when it finds a match on Sheet 1 row 21 Dell E560 P4 and Sheet 2, the reference table, which contains the exact same parameters however the row may be different, say... row 8.

    What should happen is a returned value from Sheet 2 column E8 should be returned to Sheet 1 column O.

    However, in every instance, it is returning the value from Sheet 2 E9 instead of E8, or if you expect E15 you will instead get E16... which is one cell down from the row that I think we are querying against with this formula.

    Is that clear as mud?

    Here is the formula that I'm using. Maybe it will help.

    =IFERROR(INDEX('Supp YN'!$E$2:$E$48,MATCH(1,('Supp YN'!$A$1:$A$48=L4)*('Supp YN'!$B$1:$B$48=M4)*('Supp YN'!$C$1:$C$48=N4),0)),"No Match")

    What I think it is doing, or supposed to be doing, is Indexing with a nested match against the static values in Supp YN column E, rows 2 - 48, which is where all of the return data is listed.

    It only does this if there is an exact match between cells in the same row (row 4 in the formula above, but I want to apply this formula to all 2000 rows if possible)

    The match, in this example, compares A1:A48, B1:B48, C1:C48, in my reference table. Again, I've added a static value here because this query is against a reference that will not change in any query.

    I think that the number 1 here means if it is TRUE, meaning if there is a match in the following nested MATCH, then return the value from Sheet 2 (Supp YN) column E, in the same row as the match is attempted. EXAMPLE: MATCH(1,('Supp YN'!

    I think that the zero here is what to return if there is no match: EXAMPLE: ,0)),"No Match")

    What I don't understand is why the values being returned are from one row below what is expected from Sheet 2 column E.
    Last edited by Adam859; 02-03-2016 at 11:55 PM.

  12. #12
    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,193

    Re: Multiple criteria match to return adjacent cell value

    =IFERROR(INDEX('Supp YN'!$E$2:$E$48,MATCH(1,('Supp YN'!$A$1:$A$48=L4)*('Supp YN'!$B$1:$B$48=M4)*('Supp YN'!$C$1:$C$48=N4),0)),"No Match")

    They are one row different because the INDEX row starts at row 2 ($E$2) BUT the MATCH starts at row 1 ($A$1) etc. MATCH returns a position RELATIVE to the START of the stated range(s) you are MATCHing so if your RANGES don't match the result will be out by one (or more) row(s).

    So MATCH returning 10 in the range 1 to 48 will return data from row 11 in range 2 to 48 as the 10th row starting at row 2 is row 11.

    Please change the ranges as I indicated in earlier post.

    =IFERROR(INDEX('Supp YN'!$E$2:$E$48,MATCH(1,('Supp YN'!$A$2:$A$48=L13)*('Supp YN'!$B$2:$B$48=M13)*('Supp YN'!$C$2:$C$48=N13),0)),"No Match")
    Last edited by JohnTopley; 02-04-2016 at 03:51 AM.

  13. #13
    Registered User
    Join Date
    02-02-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    7

    Re: Multiple criteria match to return adjacent cell value

    Thank you! I was able to get it working with help from everyone here.

+ 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. Look up a repeated value and return each match from adjacent cell
    By abukou in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-08-2015, 06:11 PM
  2. [SOLVED] Function to match text and return number in adjacent cell?
    By danoswalt in forum Excel General
    Replies: 6
    Last Post: 12-16-2014, 01:47 PM
  3. Replies: 4
    Last Post: 03-27-2014, 01:09 PM
  4. Search for a text string and return adjacent cell value for each match
    By ral8088 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-21-2013, 09:55 AM
  5. Find and Match Text in Column Return Adjacent Cell
    By biancam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2012, 02:45 PM
  6. Index/Match and return adjacent cell or workaround
    By alltimetop100 in forum Excel General
    Replies: 2
    Last Post: 03-02-2011, 08:24 AM
  7. Replies: 3
    Last Post: 08-17-2010, 02:54 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