+ Reply to Thread
Results 1 to 4 of 4

Rank values in one column from groups of numbers in another column

Hybrid View

  1. #1
    Registered User
    Join Date
    10-15-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    37

    Rank values in one column from groups of numbers in another column

    Hi all, so down 20 rows of column A i have ten rows of '1', five rows of '2' and five rows of '3'. column B has various decimal numbers from -10 to 50. I am looking for a formula (for column C) that ranks the numbers (ascending) in column B, taking into account the corresponding number in column A.

    So, the B numbers alongside the column A '1's should result in being ranked (1 to 10), the numbers alongside the '2's should be ranked (1 to 5) and the numbers alongside the '3's would be ranked (1 to 5).

    (The above values are merely an example, the final table would have numbers running into the thousands down column A, with each number duplicated up to 200 times.)

    Any help would be much appreciated,

    Kind regards

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,274

    Re: Rank values in one column from groups of numbers in another column

    In B2, enter the formula

    =SUMPRODUCT(($A$2:$A$20000=A2)*($A$2:$A$20000+$B$2:$B$20000<(A2+B2)))+1
    to rank lower values as lower rank number
    or
    =SUMPRODUCT(($A$2:$A$20000=A2)*($A$2:$A$20000+$B$2:$B$20000>(A2+B2)))+1
    to rank higher values as lower rank number

    and copy down. If you have more than 20000 rows of data, increase those numbers, and if many fewer, reduce them.

    If you can have ties that need to be broken, a modified formula with a tie-breaker can be used.
    Last edited by Bernie Deitrick; 06-30-2014 at 12:30 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-15-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Rank values in one column from groups of numbers in another column

    Bernie you're an absolute star, thank you so much, its highly appreciated. The tied issue shouldn't be a problem (i am into double figure decimal points in the B column), but thank you anyway.

    Kind regards

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,274

    Re: Rank values in one column from groups of numbers in another column

    I just realized that I over-complicated the formula

    =SUMPRODUCT(($A$2:$A$20000=A2)*($B$2:$B$20000<B2))+1
    to rank lower values as lower rank number
    or
    =SUMPRODUCT(($A$2:$A$20000=A2)*($B$2:$B$20000>B2))+1
    to rank higher values as lower rank number

+ 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] Having an issue with a formula used to rank column numbers earlier but now is failing .
    By Securitysports in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-02-2013, 06:04 PM
  2. [SOLVED] Ranking numbers in a column from 1 to 15 then stating the rank in another column
    By Securitysports in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-02-2013, 02:09 AM
  3. [SOLVED] Transpose numbers in groups of Column to Rows
    By Dumy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2013, 11:46 AM
  4. sum column values in groups of 12 cells
    By robarv in forum Excel General
    Replies: 3
    Last Post: 02-16-2013, 10:59 PM
  5. [SOLVED] RE: Counting groups of exact numbers in a huge list (column)
    By pgiessler in forum Excel General
    Replies: 1
    Last Post: 08-16-2006, 12:05 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