+ Reply to Thread
Results 1 to 9 of 9

Find top 5 highest values in row from every third column and return column header

  1. #1
    Registered User
    Join Date
    03-22-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    10

    Find top 5 highest values in row from every third column and return column header

    Hi there,

    I suspect that my problem may be beyond the capabilities of a function (time to relearn some VBA?), but thought I'd see if anyone had any ideas!

    I would like to find the top 3 (or any number) highest percentage values in a row, from every third column; then, copy the column headers to a new cell so I can see what the column titles are, in order, of the top 5 highest values.

    Data looks like this:
    A |B | C |D | E | F | G | H | I|
    1 25 7% 25 25 6% 25 25 12%
    2 25 8% 25 25 9% 25 25 17%


    Want:
    1 - "I" 12% "C" 7% "F" 6%
    2 - "I" 17% "F" 9% "C" 8%


    I have seen similar problems posted here and on the mr.excel forum using INDEX MATCH MATCH and LARGE - however, in all of those cases, the rows had consistent data, and didn't have to do something like only look at every third column.

    Any suggestions? Anything is appreciated!

    Cheers

    P.S. Not sure how to get my example data properly aligned - the letters were supposed to be over each number. Sorry!

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find top 5 highest values in row from every third column and return column header

    Try array entering this formula in cell J2. Copy across and down until you get blanks.If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Find top 5 highest values in row from every third column and return column header

    Hi Quart and welcome to the forum,

    Your answer needs a CSE entry of a cell formula. You need to hold down the Ctrl+Shift keys while you press Enter. See the attached for the final answer.

    CSE Small 3 with Mod 3 and Match Column Letter.xlsx

    After reading Dave's answer above, I didn't seem to work that hard... My formulas are:

    =LARGE(IF(MOD(COLUMN($A1:$I1),3)=0,$A1:$I1,0),1)
    =LARGE(IF(MOD(COLUMN($A1:$I1),3)=0,$A1:$I1,0),2)
    =LARGE(IF(MOD(COLUMN($A1:$I1),3)=0,$A1:$I1,0),3)
    Last edited by MarvinP; 03-22-2017 at 05:21 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find top 5 highest values in row from every third column and return column header

    @ MarvinP

    Yeah. That's sane.

    Still working on that part.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Find top 5 highest values in row from every third column and return column header

    Hey Dave,

    I saw that he wanted to only use the values in columns, 3,6,9... I decided these were all =0 Mod 3. I think this was the difference between our two answers. Your answer is better if he had spread out the columns he wanted to use. I might also have a problem if there are two of the same values in the top 3 for any row.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find top 5 highest values in row from every third column and return column header

    I might also have a problem if there are two of the same values in the top 3 for any row.
    Yeah. Now that you mention it so would mine. The MATCHING large to the range thing fails if there are ties.

    Hmm. My only thought is to "cheat" the difference by adding columns($j:j)/10^5 ... or something like that.

  7. #7
    Registered User
    Join Date
    03-22-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    10

    Re: Find top 5 highest values in row from every third column and return column header

    Dave, MarvinP - thank you both for the time you put in to this! A great help and much appreciated.

    I have to admit though, I'm still working through how Dave's answer/syntax actually works. May come back if I can't get it.

    There are very likely ties - I think I have something like 2000 columns. I guess I could always just increase the number of decimal points to decrease the likelihood of ties?

    Thanks again!

  8. #8
    Registered User
    Join Date
    03-22-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    10

    Re: Find top 5 highest values in row from every third column and return column header

    Quote Originally Posted by MarvinP View Post
    ..... Your answer is better if he had spread out the columns he wanted to use. ....
    Could you explain what you mean by this?

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find top 5 highest values in row from every third column and return column header

    Good deal. You're welcome. Thanks for the feedback.

+ 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] Find specific value in table and return header row and header column value
    By nelwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2013, 01:35 AM
  2. [SOLVED] Re: Find lowest 5 numbers in column A with highest values in column B
    By jd16 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-05-2013, 02:08 AM
  3. Replies: 4
    Last Post: 10-06-2013, 10:40 AM
  4. Find lowest 5 numbers in column A with highest values in column B
    By dmccoy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2013, 09:22 AM
  5. [SOLVED] Find three highest values on column A and print column B
    By diegodacal in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2013, 04:05 PM
  6. [SOLVED] find the highest text value in a row, and return the corresponding column header
    By bumbling-idiot in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-09-2012, 07:09 AM
  7. Find Max values in row then return Column Header
    By mrio in forum Excel General
    Replies: 0
    Last Post: 08-23-2006, 12:47 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