+ Reply to Thread
Results 1 to 6 of 6

How to Rank based on text in another cell

  1. #1
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    How to Rank based on text in another cell

    Does anyone know how to rank values in one column based on criteria in another column?

    For example: How do I rank Cells in Column A that only contain the text "AL" in column B? Thanks!

    COL...A....B
    ROW
    1......5....NL
    2......6....AL
    3......7....AL
    4......8....NL

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to Rank based on text in another cell

    Not sure what you mean by rank? Do you want this put somewhere else? I presume you have tried to SORT, and it didnt give you wnat you wanted?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to Rank based on text in another cell

    hi mlbdc. in descending order:
    =IF(B1="AL",COUNTIF(A:A,">"&A1),"")

    ascending:
    =IF(B1="AL",COUNTIF(A:A,"<"&A1),"")

    Edit: no.... probably need to modify. should be:
    =IF(B1="AL",COUNTIFS(A:A,">"&A1,B:B,"AL")+1,"")

    =IF(B1="AL",COUNTIFS(A:A,"<"&A1,B:B,"AL")+1,"")
    Last edited by benishiryo; 12-12-2013 at 09:42 PM.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to Rank based on text in another cell

    try
    =SUMPRODUCT(($B$1:$B$10=B1)*($A$1:$A$10>A1))+1
    or just to rank al
    =IF(B1<>"al","",SUMPRODUCT(($B$1:$B$10="al")*($A$1:$A$10>A1))+1)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: How to Rank based on text in another cell

    The formula works great for any cell with a value in it but gives a 1 to all the cells that don't have a value in it... Any ideas how to get those ones to disappear while still having the formula inserted in that particular cell?

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to Rank based on text in another cell

    =if(or(a1="",b1=""),"",sumproduct(($b$1:$b$10=b1)*($a$1:$a$10>a1))+1)

+ 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. Return text value based upon quantitative rank
    By cmyoung in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-18-2013, 05:41 PM
  2. Replies: 2
    Last Post: 11-29-2012, 11:27 AM
  3. Populating a cell with text based on the rank
    By nsdancn05 in forum Excel General
    Replies: 7
    Last Post: 10-22-2012, 05:00 PM
  4. Change cell color based on rank
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 06-07-2012, 01:01 PM
  5. Replies: 1
    Last Post: 08-15-2005, 05: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