+ Reply to Thread
Results 1 to 15 of 15

Index+Match 2 values in multiple columns

  1. #1
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Index+Match 2 values in multiple columns

    Hi team,

    I am trying to index + match 2 values in a set of columns for a third value.

    My data looks like this (can't share the original file sorry):

    Column A / column B / column c/ column d
    Rep A / apples / tomatoes /country A / country C
    Rep B / apples / tomatoes /country B / country D
    Rep C / coconuts / bananas /country A / country D
    Rep D / coconuts / tomatoes / --------- /country E


    the information is all in a line (like above) and i need to put in a table where i have as a header the Country and on the rows the fruits. This needs to fill up with the name of the rep that sells in that country for each of the fruits.
    in my original file i have like 23 fruits and 49 countries covered by only 7 reps. My goal is to have this graphic table to spot which combination of fruit and country is not covered.

    like:

    Column A / Column B / Column C / Column D / column E
    ////////// country A / Country B / Country C / Country D / country E
    Apples Rep A / Rep B / Rep A
    Tomatoes ------- / Rep B / ----------- / Rep B /Rep D
    Coconuts Rep C / ------------ / ----------- / Rep C
    Bananas

    what i have tried was using index + match but because i have to do a combination of country + fruit in order to get the rep that sells them.

    {=INDEX(Sheet1!$A:$A,MATCH(1,(Sheet1!$B$1:$c$4 (the fruit ranges) =$b$1 (the fruit Name))*(Sheet1!$c$1:$d$4 (the country ranges) =a$2 (the country name),0))}

    I am guessing it is not working because the match does not look properly in the 2 ranges and doesn't check all the combinations available in those columns and ranges ... therefor i'm stuck.


    Please let me know if you need more information.

    Kind regards,
    Beginer

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Index+Match 2 values in multiple columns

    Can you post a SMALL sample file and show us what result you expect?

    A SMALL file will have about 20 rows worth of data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    Hi,

    yes sure.

    please note the table at the back (final form) is not fully filled as for even a few rows it takes a tremendous amount of time
    Attached Files Attached Files

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Index+Match 2 values in multiple columns

    Sorry, I'm struggling to understand how the Final Form is being filled in.

  5. #5
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    Hi Tony,

    I need to add the rep that matches 2 criteria country + fruit in the intersecting cells.
    for example:
    in my file you have rep E. he covers country X and sells tomatoes and apples. in the final form i need to have an entry in my table for country x column intersecting with apples row . that intersection should contain rep E (because he sells apples in country x).

    i have highlighted the above in the file.

    Thanks

    kind regards,
    Beginer
    Attached Files Attached Files

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Index+Match 2 values in multiple columns

    Still not sure if this is correct...

    Raw data:

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Sales Rep
    countries
    fruits
    2
    Rep A
    country a
    country c
    country d
    country e
    banana
    tomatoes
    apples
    grapes
    3
    Rep B
    country b
    country f
    grapes
    4
    Rep C
    country a
    country f
    country d
    peanuts
    5
    Rep D
    country b
    country x
    coconut
    6
    Rep E
    country x
    tomatoes
    apples


    Final Form...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    15
    Country A
    Country B
    Country C
    Country D
    Country E
    Country F
    Country x
    16
    Banana
    Rep A
    Rep A
    Rep A
    Rep A
    17
    Apples
    Rep A
    Rep A
    Rep A
    Rep A
    Rep E
    18
    coconut
    Rep D
    Rep D
    19
    grapes
    Rep A
    Rep B
    Rep A
    Rep A
    Rep A
    Rep B
    20
    tomatoes
    Rep A
    Rep A
    Rep A
    Rep A
    Rep E
    21
    peanuts
    Rep C
    Rep C
    Rep C


    This array formula** entered in B16:

    =IFERROR(INDEX($A$2:$A$6,MATCH(2,MMULT(($B$2:$E$6=B$15)+($F$2:$I$6=$A16),TRANSPOSE(COLUMN($B$2:$E$6)^0)),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy across to H16 then down to B21:H21.

  7. #7
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    Hi Tony,

    Unfortunately it is not working .
    it gives me invalid all over :-s / i replaced the "" in your formula with "Invalid"


    attached is a bigger chunk of my original file, hope it helps.

    kind regards,
    Beginer


    PS: i know about the array formulas with ctrl shift enter, i was using it on my formula as well.
    Attached Files Attached Files
    Last edited by Beginer25; 04-17-2015 at 07:55 AM.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Index+Match 2 values in multiple columns

    Hi.

    I can't see your attempt at adapting Tony's formula anywhere in this book?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  9. #9
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    Hi Xor,

    Attached.


    Kind regards,
    Beginer

    Edit:
    for some reason the file has not saved the array command.. reattaching
    Attached Files Attached Files
    Last edited by Beginer25; 04-17-2015 at 08:50 AM.

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Index+Match 2 values in multiple columns

    Thanks.

    For a start, you haven't entered it as an array formula.

    Secondly, you appear to have 5 column's worth of data for your countries (columns B:F), yet only 4 for your industries (columns H:K).

    Can you clarify?

    Regards

  11. #11
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    Hi Xor,

    I have reattached the file with the Array on. unfortunately same result. (my previous post)

    The number of countries and industries is a lot larger and not equal ( i have like 23 industries and 49 countries covered by only 7 reps). i have only sent a part of the file. I can't share the full file, sorry.

    my aim was to use the formula from Tony to the full extent of my file. however this is not working even for a small batch


    Kind regards,
    Beginer

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Index+Match 2 values in multiple columns

    I see.

    C10:

    =IFERROR(INDEX($A$2:$A$5,MATCH(1,MMULT(N($B$2:$F$5=C$9),TRANSPOSE(COLUMN($B$2:$F$5)^0))*MMULT(N($H$2:$K$5=$B10),TRANSPOSE(COLUMN($H$2:$K$5)^0)),0)),"Invalid")

    Regards

  13. #13
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    woop!!!

    it works!

    thank you very much buddy!


    kind regards,
    Beginer

  14. #14
    Registered User
    Join Date
    03-01-2013
    Location
    Romānia
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Index+Match 2 values in multiple columns

    woop!!!

    it works!

    thank you very much buddy!


    kind regards,
    Beginer

  15. #15
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Index+Match 2 values in multiple columns

    You're welcome!

+ 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. Looking for Values in Different Columns - VLOOKUP, MATCH, INDEX ???
    By juandyer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-24-2015, 01:41 AM
  2. [SOLVED] Multiple Match Values in Excel Using INDEX-MATCH
    By andrugrasu in forum Excel General
    Replies: 8
    Last Post: 03-20-2015, 09:57 PM
  3. Using Index/Match to return multiple values for one match
    By superboy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2014, 06:21 PM
  4. [SOLVED] Index / Match across multiple columns
    By Chad B in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2013, 11:52 AM
  5. [SOLVED] Lookup match index multiple values return other columns
    By martypocock in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 11-07-2012, 10:57 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