+ Reply to Thread
Results 1 to 8 of 8

Extract Top N Values in Each Group

  1. #1
    Registered User
    Join Date
    12-04-2020
    Location
    Antipolo City, Philippines
    MS-Off Ver
    Microsoft Office Excel 2019 and 2021
    Posts
    17

    Extract Top N Values in Each Group

    Good evening. Please, I need some help.

    How can I extract the Top 5 values from each group? I want to figure out who are the Top 5 states from each heat based on the number of points.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    60,733

    Re: Extract Top N Values in Each Group

    Which version(s) of Excel will this need to work on? Your profile, as it stands, is not too helpful.
    Ali


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


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  3. #3
    Registered User
    Join Date
    12-04-2020
    Location
    Antipolo City, Philippines
    MS-Off Ver
    Microsoft Office Excel 2019 and 2021
    Posts
    17

    Re: Extract Top N Values in Each Group

    I am using Excel 2021, thank you.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    60,733

    Re: Extract Top N Values in Each Group

    OK - I think this will work in 2021. In J4 copied down:

    =FILTER($B$2:$B$57,($E$2:$E$57=$I$2)*($G$2:$G$57=$I4))

    Adjust for each heat.

  5. #5
    Registered User
    Join Date
    12-04-2020
    Location
    Antipolo City, Philippines
    MS-Off Ver
    Microsoft Office Excel 2019 and 2021
    Posts
    17

    Re: Extract Top N Values in Each Group

    There is a tie for 5th place in Heat 5. How can I fix this so it leaves with only one value? I made this formula to count how many times it occur: =COUNTIFS($E$2:$E$57,E2,$F$2:$F$57,">"&F2)+1

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    60,733

    Re: Extract Top N Values in Each Group

    What do you mean by 'only one value'? Not clear (to me).

  7. #7
    Valued Forum Contributor dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    Microsoft Office 365
    Posts
    1,083

    Re: Extract Top N Values in Each Group

    I believe the fix for this if you don't care about tie breaking criteria is to enter ALI's formula above as an array formula using CTRL + SHIFT + ENTER. If done so correctly this will add { } around your formula.
    This will remove the multiple entries for 5th place as it will only show the first one.
    <----- If you are happy with your solution please click on the "* Add Reputation" as a way to say thank you.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    12,096

    Re: Extract Top N Values in Each Group

    Another option is
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which will return 5 rows. If your data is always sorted descending on the points column, there is no need for the sort

+ 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. Extract Group of Excel chart to PPT Slide and put a header for that group
    By alpharobot in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2022, 10:33 AM
  2. Replies: 5
    Last Post: 05-29-2021, 03:04 AM
  3. [SOLVED] formula to extract and group
    By louis128 in forum Excel General
    Replies: 9
    Last Post: 01-16-2019, 02:38 PM
  4. [SOLVED] Extract data from each group
    By KingTamo in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-18-2018, 01:01 PM
  5. Replies: 6
    Last Post: 08-09-2016, 10:50 AM
  6. Extract data from multiple columns, group and sum up unique values
    By Alcotraz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-05-2015, 06:54 PM
  7. Macro to extract data into different tabs for each values in column D "Group"
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2012, 03:30 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