+ Reply to Thread
Results 1 to 7 of 7

Retrieving column and row header for n maximum values in array with repeated values

  1. #1
    Registered User
    Join Date
    02-17-2023
    Location
    Barcelona, Spain
    MS-Off Ver
    Microsoft Drive
    Posts
    4

    Retrieving column and row header for n maximum values in array with repeated values

    Hi all!

    I've got this spreadsheet with points obtained by different players (columns) using different items (rows).

    I'd like to get an ordered list of the n maximum values within this spreadsheet, with the name of the item used and the name of the player it corresponds to (i.e., getting the column and row header for each of the n maximum values). The issue is that some of the values are repeated, and excel doesn't seem to know which item/player it should reference in this case.

    My data is located in array B2:H60; the column headers are in B1:H1 and the row headers are in A2:A60, and I want to have 3 columns: one with the top n values, another with the row header corresponding to the nth largest number and another with the column header corresponding to the nth largest value

    Here's an image of my spreadsheet for reference.

    Screen Shot 2023-02-17 at 13.38.30.png

    Thanks a lot!

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Retrieving column and row header for n maximum values in array with repeated values

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    02-17-2023
    Location
    Barcelona, Spain
    MS-Off Ver
    Microsoft Drive
    Posts
    4

    Re: Retrieving column and row header for n maximum values in array with repeated values

    Hi,

    here's the excel file. As you can see, column L has the list of the largest n values (that was easy), while column M has the list of the associated players (that was a bit trickier for a noob like me), but when there are repeated values on column L, it doesn't seem to know how to differentiate them. Column N should have the item name associated to the largest n value, but I don't know how to do it.

    Thanks again!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Retrieving column and row header for n maximum values in array with repeated values

    Try this,

    M2
    =INDEX($A$1:$J$1,AGGREGATE(15,6,COLUMN($B$1:$J$1)/($B$2:$J$60=L2),COUNTIF($L$2:L2,L2)))

    copied down

  5. #5
    Registered User
    Join Date
    02-17-2023
    Location
    Barcelona, Spain
    MS-Off Ver
    Microsoft Drive
    Posts
    4

    Re: Retrieving column and row header for n maximum values in array with repeated values

    I'm afraid this doesn't work...

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Retrieving column and row header for n maximum values in array with repeated values

    I made a mistake. I didn't notice n column.

    try this,
    M2
    =INDEX($A$1:$J$1,INT(AGGREGATE(15,6,(10^4*COLUMN($B$1:$J$1)+ROW($A$2:$A$60))/($B$2:$J$60=L2),COUNTIF($L$2:L2,L2))/10^4))
    copied down.

    N2
    =INDEX($A:$A,MOD(AGGREGATE(15,6,(10^4*COLUMN($B$1:$J$1)+ROW($A$2:$A$60))/($B$2:$J$60=L2),COUNTIF($L$2:L2,L2)),10^4))
    copied down.
    Attached Files Attached Files
    Last edited by windknife; 02-18-2023 at 09:53 AM.

  7. #7
    Registered User
    Join Date
    02-17-2023
    Location
    Barcelona, Spain
    MS-Off Ver
    Microsoft Drive
    Posts
    4

    Re: Retrieving column and row header for n maximum values in array with repeated values

    Works like a charm!

    Thanks a lot windknife, I couldn't have done it myself

+ 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. [SOLVED] the code is finding repeated values but i need to search values from E column to D
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2014, 01:33 AM
  2. Replies: 1
    Last Post: 10-11-2014, 04:52 AM
  3. [SOLVED] Append data to repeated values with a fixed array to be repeated on value change
    By anchuri_chaitanya in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2011, 12:30 AM
  4. create list of unique values from a column with repeated values?
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  5. create list of unique values from a column with repeated values?
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  6. [SOLVED] create list of unique values from a column with repeated values?
    By Chad Schaben in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  7. create list of unique values from a column with repeated values?
    By Chad Schaben in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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