+ Reply to Thread
Results 1 to 9 of 9

INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

  1. #1
    Registered User
    Join Date
    08-13-2021
    Location
    Toulouse, FR
    MS-Off Ver
    2013
    Posts
    4

    Question INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    Hello,

    I created a formula based on many post's helping users to get the top X rows of a table depending on a value in a specific column af the row.

    I have an Epics table containing an Epic element in each line. One of the columns correspond to the Cost Deviation, another one to the FixVersion. I want to get the Top 5 Epics Keys by Cost Deviation for a given FixVersion and display them in another 5 cells.

    The array formula I've created is as follows :

    In french:
    {=SIERREUR(INDEX(JEpicsTable[[Key]:[Key]];EQUIV(PETITE.VALEUR(NB.SI.ENS(JEpicsTable[[Cost Deviation]:[Cost Deviation]];">"&JEpicsTable[[Cost Deviation]:[Cost Deviation]];JEpicsTable[[FixVersions]:[FixVersions]];"*"&C$4&"*");LIGNE(1:1));NB.SI.ENS(JEpicsTable[[Cost Deviation]:[Cost Deviation]];">"&JEpicsTable[[Cost Deviation]:[Cost Deviation]];JEpicsTable[[FixVersions]:[FixVersions]];"*"&C$4&"*");0));"")}

    In french simplified:
    {=SIERREUR(INDEX(JEpicsTable[Key];EQUIV(PETITE.VALEUR(NB.SI.ENS(JEpicsTable[Cost Deviation];">"&JEpicsTable[Cost Deviation];JEpicsTable[FixVersions];"*"&C$4&"*");LIGNE(1:1));NB.SI.ENS(JEpicsTable[Cost Deviation];">"&JEpicsTable[Cost Deviation];JEpicsTable[FixVersions];"*"&C$4&"*");0));"")}

    In english simplified:
    {=IFERROR(INDEX(JEpicsTable[Key],MATCH(SMALL(COUNTIFS(JEpicsTable[Cost Deviation],">"&JEpicsTable[Cost Deviation],JEpicsTable[FixVersions],"*"&C$4&"*"),ROW(1:1)),COUNTIFS(JEpicsTable[Cost Deviation],">"&JEpicsTable[Cost Deviation],JEpicsTable[FixVersions],"*"&C$4&"*"),0)),"")}

    The value of the given FixVersion is in C$4.

    I am supposed to obtain the Top 5 elements by incrementing the ROW(1:1) like this : ROW(1:1), ROW(2:2), ROW(3:3)... but actually I obtain some duplicated keys in my results like A, A, A, B, B, C, D, E, F, F, G...
    All correct keys are there and in the correct order, but since there are some duplicated lines in the results, I can't obtain dynamically the Top 5 by just incrementing the row index from 1 to 5.

    Is there any way to filter duplicates (Duplicated keys in the results not duplicated Cost Deviations in the considered data) ? or to prevent genereting them by adapting the formula ?
    I'm new into array formulas and I'm not sure I completely understanding what Excel is internally doing whith the CountIfs. Evaluate formula didn't help me to get it.

    Thanks in advance for your help,
    Xavier

    Update 2021/08/30: Excel example has been attached to the post. It shows how repeated results are shown in the list, as well as some bigger values than others that are ignored. Thanks in advance for your help.
    Attached Files Attached Files
    Last edited by xavigg; 08-30-2021 at 10:42 AM. Reason: Adding Example

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-13-2021
    Location
    Toulouse, FR
    MS-Off Ver
    2013
    Posts
    4

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    Thanks! I've attached the example file as requested, my apologies.

    Xavier

  4. #4
    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-SMALL-COUNTIFS returning duplicated results

    Hi,

    In your file, why is the second returned value of 2 (cell F3) marked as "OK"? That Key is associated with Fix Version "V2", not "V1", so I would have thought it should be ignored. Or am I missing something?

    Regards
    Click * below if this answer helped

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

  5. #5
    Registered User
    Join Date
    08-13-2021
    Location
    Toulouse, FR
    MS-Off Ver
    2013
    Posts
    4

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    Hi,

    thanks for your help.
    Indeed, theres seems to be a problem with my exemple. It is not filtering by version even if the filter is declared. I've tired to remove the * wildcard but I obtain the same result. There is a problem with my filter JEpicsTable[[Fix Versions]:[Fix Versions]];"V1" ?

    Thanks in advance,
    Xavier

  6. #6
    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-SMALL-COUNTIFS returning duplicated results

    In F2:

    =IF(ROWS(F$1:F1)>COUNTIFS(JEpicsTable[Fix Versions],"*V1*"),"",LOOKUP(1,0/FREQUENCY(0,1/(1+COUNTIFS(JEpicsTable[Cost Deviation],"<="&JEpicsTable[Cost Deviation])*(COUNTIFS(F$1:F1,JEpicsTable[Key])=0)*ISNUMBER(SEARCH("V1",JEpicsTable[Fix Versions])))),JEpicsTable[Key]))

    and copied down.

    Regards

  7. #7
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,416

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    Cell F2 Array formula , Drag down

    HTML Code: 

  8. #8
    Registered User
    Join Date
    08-13-2021
    Location
    Toulouse, FR
    MS-Off Ver
    2013
    Posts
    4

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    It works perfectly! Thanks a lot.
    On the other hand, it seems black magic XD. I wouldn't been able to produce this formula, mainly beacuse I don't even understand it completely...

    I guessed it is an array formula so I entered with SHIFT+ENTER. Maybe it is not the case.

    Is the ISNUMBER function related to the fact that my Key column contains only numbers ? In my real file they are more complex strings. May I replace ISNUMBER by !ISEMPTY ?

    Thanks,
    Xavier

  9. #9
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,416

    Re: INDEX-MATCH-SMALL-COUNTIFS returning duplicated results

    You're Welcome. Glad to help . Thank You for the feedback

    Use with each other ISNUMBER not only contains numbers + SEARCH and FIND Can distinguish between uppercase and lowercase

    SHIFT+ENTER pls change to CTRL+SHIFT+ENTER
    Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Last edited by wk9128; 08-31-2021 at 10:23 AM.

+ 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. How to exclude a value from INDEX MATCH SMALL IF results based on criteria ?
    By TheGodfather in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-24-2020, 03:48 PM
  2. Replies: 3
    Last Post: 01-31-2019, 08:00 PM
  3. Using INDEX, MATCH, and COUNTIFS to dissect survey results
    By gramdaman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-21-2017, 04:12 PM
  4. [SOLVED] Index Small If Row Column formula not returning all results
    By EmmatheDancer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-10-2015, 06:34 AM
  5. [SOLVED] Index Small If array formula with mulitple criteria returning incorrect results
    By EmmatheDancer in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-08-2015, 12:52 PM
  6. [SOLVED] Using Index match and small to come up with different results from same lookup
    By sirbletchley in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-19-2015, 07:37 PM
  7. [SOLVED] index match not returning all results
    By nellyc in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-06-2013, 11:22 AM

Tags for this Thread

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