+ Reply to Thread
Results 1 to 14 of 14

Match / Index duplicate value problem

  1. #1
    Registered User
    Join Date
    02-11-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Match / Index duplicate value problem

    Hi all,

    I have a table with 3 columns, the first being static text "issue types" and the second two dynamic values created from counting instances of each issue type from another sheet.

    I want to create a table of the top 5 issues which updates automatically. I can use the LARGE function to list the top 5 values, and then need to match these to the issue type.

    Where I'm having problems is when there are duplicate numbers for results in the top 5, it will match the first instance 'issue type' for all duplicated entries. Instead I need to put a check in place so that it moves down the table rows to the next instance of the matched number and indexes that issue type instead.

    I know that probably isn't very clear, so please see the attached spreadsheet example for ready made tables and formulas.

    Thanks!
    Attached Files Attached Files
    Last edited by muppetthumper; 07-07-2010 at 07:56 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Match / Index duplicate value problem

    Try:

    =INDEX($A$2:$A$16,SMALL(IF(C$2:C$16=$F4,ROW($A$2:$A$16)-ROW($A$2)+1),COUNTIF($F$4:$F4,$F4)))

    and confirm it with CTRL+SHIFT+ENTER
    not just ENTER and copy down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-11-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Match / Index duplicate value problem

    Quote Originally Posted by NBVC View Post
    Try:

    =INDEX($A$2:$A$16,SMALL(IF(C$2:C$16=$F4,ROW($A$2:$A$16)-ROW($A$2)+1),COUNTIF($F$4:$F4,$F4)))

    and confirm it with CTRL+SHIFT+ENTER
    not just ENTER and copy down
    Although I have failed in my attempts to understand how the logic is working, it works a treat! Thanks very much

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Match / Index duplicate value problem

    Please Login or Register  to view this content.
    is like a vlookup for multiple matches... It uses the Index() function which requires you to index the table or column to extract from and it requires the Row number to extract from which is gotten from this part: SMALL(IF(C$2:C$16=$F4,ROW($A$2:$A$16)-ROW($A$2)+1)

    The Small() function just allows us to step up and extract one match at a time, starting from the first match found. It will extract only if a match to F4 is found in range C2:C16 and then it will return the corresponding row number within the range. The -ROW($A$2)+1 is added for robustness (incase you insert rows above, then the result won't skew).

    The last part: COUNTIF($F$4:$F4,$F4)) is the k factor for the Small() function, which is like a step factor in a For...next loop in VBA. It "loops" through each consecutive match (i.e. it is counting the number of times the current item in F matches from the start of column F to the current position and uses that to determine the k factor)

    The CSE confirmation is because it is an array formula and you have to confirm with those keys to make these formulas work.

    Then you copy down...

    Hope this clarifies a bit.

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Thumbs up Re: Match / Index duplicate value problem

    I have to thank you for this formula. I have a thread open that was about the same thing and this solved my problem. Thanks again

  6. #6
    Registered User
    Join Date
    04-18-2012
    Location
    Algeria
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Match / Index duplicate value problem

    Thanks a lot for this solution it the best one that I found since now.

    Best regards.

  7. #7
    Registered User
    Join Date
    10-09-2012
    Location
    Thailand
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Match / Index duplicate value problem

    Wow great solution ever. Thanks a lot.

  8. #8
    Registered User
    Join Date
    11-07-2016
    Location
    Barbados
    MS-Off Ver
    2010
    Posts
    24

    Re: Match / Index duplicate value problem

    I am currently having a similar issue with some data that I am using. I have been trying to manipulate the formula for my own information but I'm having no success. I think I won't be able to use the "Small" function given that my duplicate information is in text.

    Logically the formula provided is what I'd like to use with my data, so that if for example there are duplicate names, the formula moves down to the next instance. However instead of duplicate numbers I have duplicate text.

    Can this formula be tweaked to apply to duplicate text?

    See my sample file below attached.
    Attached Files Attached Files

  9. #9
    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: Match / Index duplicate value problem

    Livvi, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    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

  10. #10
    Registered User
    Join Date
    11-07-2016
    Location
    Barbados
    MS-Off Ver
    2010
    Posts
    24

    Re: Match / Index duplicate value problem

    Opps! Apologies!

  11. #11
    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: Match / Index duplicate value problem

    Not a problem

  12. #12
    Forum Contributor
    Join Date
    11-21-2013
    Location
    zimbabwe
    MS-Off Ver
    Excel 2003
    Posts
    124

    Re: Match / Index duplicate value problem

    Quote Originally Posted by Livvi View Post
    I am currently having a similar issue with some data that I am using. I have been trying to manipulate the formula for my own information but I'm having no success. I think I won't be able to use the "Small" function given that my duplicate information is in text.

    Logically the formula provided is what I'd like to use with my data, so that if for example there are duplicate names, the formula moves down to the next instance. However instead of duplicate numbers I have duplicate text.

    Can this formula be tweaked to apply to duplicate text?

    See my sample file below attached.
    Try this for C14 cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy down then right

  13. #13
    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: Match / Index duplicate value problem

    soledad Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction then send a private message to them asking for clarification.

  14. #14
    Registered User
    Join Date
    02-16-2018
    Location
    BANGALORE
    MS-Off Ver
    2016
    Posts
    1

    Re: Match / Index duplicate value problem

    Thanks a lot for this solution

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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