+ Reply to Thread
Results 1 to 8 of 8

Replace values with a value indicating ranking, based on the values, within each group

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Beirut
    MS-Off Ver
    Excel OSX
    Posts
    38

    Arrow Replace values with a value indicating ranking, based on the values, within each group

    I have a sheet with many rows. Each group consists of an unequal number of rows. How can I replace each value for a number that indicate the ranking of this value, within each group, for each shop.

    See the file for a better idea.

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,278

    Re: Replace values with a value indicating ranking, based on the values, within each group

    Try this in E21 dragged down:

    =1+SUMPRODUCT(($A$4:$A$15=A4)*($E$4:$E$15>E4))&"/"&COUNTIF($A$4:$A$15,A4)

    Caveat: this ranks in the traditional way, i.e. if there is a tie for first place, the next ranking will be 3, not 2. Also it will not ignore blank cells. Maybe you or somebody else will be able to refine it suitably.

    I cannot help with the modal formula as I am afraid I don't understand the maths behind it.

    By the way, I have visited Lebanon (and Beirut) a few times - it's a beautiful country. My daughter is half Lebanese.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Replace values with a value indicating ranking, based on the values, within each group

    A modification of AliGW's solution. This is closer to your requirement (Note that there was a mistake in the expected answer in E37-E30: it should have been /3 and not /2).

    In E21, copied across and down:

    =IFERROR(IF(E4="",NA(),1+SUMPRODUCT(($A$4:$A$15=$A4)*(E$4:E$15>E4))&"/"&COUNTIFS($A$4:$A$15,$A4,E$4:E$15,">"&0)),"")
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,278

    Re: Replace values with a value indicating ranking, based on the values, within each group

    Thanks for the rep! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Replace values with a value indicating ranking, based on the values, within each group

    APT. Also... thanks for the Rep. can you try to explain what you meant by the second part of your query. I didn't really follow what you wanted....

  6. #6
    Registered User
    Join Date
    04-29-2013
    Location
    Beirut
    MS-Off Ver
    Excel OSX
    Posts
    38

    Re: Replace values with a value indicating ranking, based on the values, within each group

    AMAliGW and Glenn Kennedy,

    Thanks for your help. I ended up using Glenn Kennedy's solution and it worked out great.

    In regard to the second portion of my question, I want a formula that calculates "Modal Rank within Group". The resulting number would give a notion of what the most common ranking, for that give item, is across all shops. For example if the most common ranking of an item, ignoring the denominator (i.e. no. of items within each group), is "2" then I'm calling this number the modal ranking within the item, across shops. This would be the case in this set for example: {1/2, 2/3, 4/5, 2/4, 2/5)}

    The difficult here is that while in ShopA item 3 (from group 222) may be ranked as 2/3, in ShopD it is ranked 2/4, while the other rankings for this item are: 5/5 in ShopB and 4/5 ShopC. Thus, it's not entirely clear to me that saying the 'modal ranking' is 2, since I'm ignoring the denominator. This is a more of an issue I will have to figure out, but any suggestions are welcome! (perhaps some sort of average? Note: non-math person, here!)

    Any suggestions to generate the modal ranking? I tried the following, which ignores the denominator (i.e. no. of items within each group): {=MODE(MATCH(E21:I21,E21:I21,0))}
    ..yet it fails in most cases.

    Thanks again!

    PS. AMAliGW, indeed, Lebanon is nice. Glad you liked it!
    Last edited by AntiPivotTable; 10-21-2016 at 12:02 PM.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Replace values with a value indicating ranking, based on the values, within each group

    This looks worse than it is, because I had to strip out all the /n values... another array formula:

    =MODE(IF(IF(ISNUMBER(--LEFT(E21:I21,SEARCH("/",E21:I21)-1)),--LEFT(E21:I21,SEARCH("/",E21:I21)-1),FALSE)>0,IF(ISNUMBER(--LEFT(E21:I21,SEARCH("/",E21:I21)-1)),--LEFT(E21:I21,SEARCH("/",E21:I21)-1),FALSE)))
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-29-2013
    Location
    Beirut
    MS-Off Ver
    Excel OSX
    Posts
    38

    Re: Replace values with a value indicating ranking, based on the values, within each group

    That is great thank you!

    Now, I was thinking that normalizing/standardizing the rankings AND THEN taking some sort of average or mode across the shops would be a good way to deal with the fact that the item ranking within each group, across each shop, are each on a different rank scale. I tried transforming/standardizing to a 1-3 scale ranking using the following formula:

    x_t=2*( (x_i − xmin) / (xmax−xmin) )+1

    where xmin and xmin are the minimum and maximum possible ranking in the specific scale for the item, and x_i is the (current, pre-transformation) item ranking.

    I tried to implement this formula but couldnt for two reeasons: 1) it appears that the rankings numbers inside the table (ie. range: E21:I32) are not really number values; and 2) Naturally, in my case, the xmin and xmax would have to vary from group to group and across shops.

    Can you guide me on how I can apply this formula to the normalize the rankings within the table in your example? Thanks again for your time!

+ 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] Ranking with duplicate values while ignoring zeros and negative values
    By mfortier3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2017, 04:43 AM
  2. [SOLVED] Ranking formula based on values in multiple columns taken from a different sheet
    By m_t in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-15-2016, 03:52 PM
  3. [SOLVED] Function indicating last use of 2 different values
    By rluesc in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-26-2015, 04:57 AM
  4. [SOLVED] Assign a Ranking Score Based on Values in Other Columns
    By reluctantresearch in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-27-2014, 11:08 AM
  5. Ranking based on values
    By bpctrader in forum Excel General
    Replies: 5
    Last Post: 02-05-2012, 05:49 PM
  6. Ranking based on Group
    By ahas_banra in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-21-2011, 09:00 AM
  7. Formula indicating duplicate values in a range
    By Victoria in forum Tips and Tutorials
    Replies: 11
    Last Post: 02-09-2007, 06:53 PM

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