+ Reply to Thread
Results 1 to 14 of 14

Labels and values associated with Top-N values in a range

Hybrid View

  1. #1
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Labels and values associated with Top-N values in a range

    In this spreadsheet (worksheet 'Aggregate') I am looking for a way to list the Top-10 from the values from columns like US, U etc. on the right. So for instance in Column N, I'd want the To-10 words from column A that have the highest value in column B (US) listed in declining order with the corresponding actual values from Column B next to them. Could anybody please help me in finding the right formula? Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Labels and values associated with Top-N values in a range

    See the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    Hoi Oeldere!'

    Dank. But it's not exactly what I wanted. You now have the values rankordered. But what I would like to have are the actual words from column A in that column, with these values next to them. And then the next column would have the top-N words for Column C, with THEIR values next to them, and so on.

  4. #4
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Labels and values associated with Top-N values in a range

    run the top10 macro
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    Wow! This is amazing. Thanks so much rcm. And can this macro also run on other worksheets? They all have the same structure, with the one exception that the length of the columns might differ.

  6. #6
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Labels and values associated with Top-N values in a range

    1. If the column named COUNT could be at the end of the countries one could determine how many countries need to be computed, and also determine when to start filling the countries top-10 (this is not coded yet)

    2. The width of each column can be self adjusted with the instruction => .autofit so no problems with the column with. I'll add this feature to the macro.

  7. #7
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    rcm - is there any way you could annotate the macro in such a way that users (in this case I , but I can imagine others might want sthg similar) know where to make which changes in order to accommodate changes in the structure of their worksheets? Also, the macro is actually macro1 I guess and not top10. Thanks!

    And to all - is there really no way to do this just with a formula instead of with a macro?
    Last edited by sdspieg; 03-21-2013 at 09:56 PM.

  8. #8
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Labels and values associated with Top-N values in a range

    I parametized all variables in the GIVENS tab just need to fill the A2,B2,C2 and hit the BUTTON in the chosen tab
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    My apologies for asking this again - but just out of curiosity; IS doing such a thing possible without a macro and with just a formula as well, or not?

  10. #10
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,679

    Re: Labels and values associated with Top-N values in a range

    Yes it can, I only made a formula for US.
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  11. #11
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    [deleted - duplicate]
    Last edited by sdspieg; 03-23-2013 at 07:54 PM.

  12. #12
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    Looks excellent! And it seems to work like a charm for the US.
    =INDEX($A$2:$A$966,MATCH(LARGE(($B$2:$B$966)+ROW($B$2:$B$966)/1000,ROW()-2),($B$2:$B$966)+ROW($B$2:$B$966)/1000,0))

    But when I try to adapt the formula for another column (e.g. the UK, which is in the C column), I try to just replace all the 'B's with 'C's in the formula, but I then get an error message. If I would understand the 'logic' of the formula, I'd probably be able to figure it out, but I'm afraid I do not. Can anybody please just explain which changes have to be made in order to make them all work? Thanks!

  13. #13
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    Looks excellent! I'll start trying it out! Thanks much...

  14. #14
    Registered User
    Join Date
    03-20-2013
    Location
    Amsterdam
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Labels and values associated with Top-N values in a range

    Haaaa! I figured it out. These are of course array formulae that require Ctrl-Shift-Enter! Silly me. And man you guys are good!!!

+ 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