+ Reply to Thread
Results 1 to 5 of 5

How to give an item a value based on it's position in the list

  1. #1
    Registered User
    Join Date
    12-06-2018
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365 Subscription
    Posts
    17

    How to give an item a value based on it's position in the list

    Hi,

    I have a large dataset of golfers and some of their stats. The list contains 450 players. Each stat is weighted differently, giving the highest ranked player the most points down to the last place getting the least amount of points. Right now this is the code that I have

    =IF(B2=MAX(B$2:B$450),Q$10,IF(B2=LARGE(B$2:B$450,2),Q$11,IF(B2=LARGE(B$2:B$450,3),Q$12,IF(B2=LARGE(B$2:B$450,4),Q$13,0))))

    The values under column Q being the amount of points that player gets based on a table I made.

    So essentially I'm testing the cell to see where it ranks among other cells in that category. This works the way I want, except that I would have to write IF(B2=LARGE(B$2:B$450,2) 450 times. I imagine there is a better way but I don't know how. Any suggestions are greatly appreciated. Thanks!

    I included a sample of the sheet the show what I'm trying to do. Hopefully that helps make it clear.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: How to give an item a value based on it's position in the list

    If the values to be sorted were {60;60;60;61;62;65;65;67} with lowest best, MIN(values) = SMALL(values,2) = SMALL(values,3). If N (> 1) different golfers all had the same best value, shouldn't all N of them receive the same points for that value?

    My point: use a table. If columns Y and Z were available, and since you show you're using Office 365 so should have spilled formulas,

    Y1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Y2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Fill Y2 down until the formula returns 0. Enter the corresponding points in column Z. Use LOOKUP to pull points for each player, e.g.,

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The -s are needed because column Y would be in descending order. Taking negatives puts them in ascending order, which is what LOOKUP expects.

    Point: tables are BY FAR the best way to approach this sort of thing.

    OK, you could use XLOOKUP.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    but from my perspective using negatives for LOOKUP's 1st and 2nd arguments is easier. Then again, if brevity were paramount and all columns in the table were numeric,

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ADDED: if some other score should be sorted smallest to largest, say, column C, then using columns AB and AC for another table,

    AB1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    AB2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Fill AB2 down until the formula returns 0, and clear the cell with the formula returning 0. Enter corresponding points in column AC. The LOOKUP formula would be simpler because column AB would be in ascending order.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by hrlngrv; 04-08-2021 at 09:12 PM. Reason: addendum

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,641

    Re: How to give an item a value based on it's position in the list

    Start in F2, we need to determine B2 rank:
    (A)=RANK(B2,$B$2:$B$436)
    or
    (B)=SUMPRODUCT(--(B$2:B$436>=B2))

    Then using INDEX() :

    Please Login or Register  to view this content.
    The only difference between (A) and (B) is which outcome if there were duplicate points.
    Quang PT

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to give an item a value based on it's position in the list

    ARRAY formula in F2 then copied across to columns G, H and I

    =IFERROR(INDEX(Q$10:Q$22,MATCH(B2,LARGE(B$2:B$450,ROW($1:$13)),0)),"")
    .
    To enter ARRAY formula
    Copy and paste the formula in cell
    Press F2
    Press Ctrl+Shift+Enter together
    Excel covers the formula with {}.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 04-09-2021 at 12:36 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  5. #5
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: How to give an item a value based on it's position in the list

    OP's profile shows Office 365. If that's the case, array formula entry no longer needed. Indeed, an unnecessary complication.

+ 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. Replies: 1
    Last Post: 08-22-2019, 04:16 AM
  2. Formula which give you start position based on input
    By vba1234 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-15-2016, 03:41 PM
  3. VLOOKUP That needs to give result based on a ranking list
    By Sanecrazy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-16-2012, 11:38 PM
  4. How to create drop down list in Excel where each list item is based on two columns?
    By matkiros in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2012, 08:50 AM
  5. Check position of a value and give checkmark
    By sans in forum Excel General
    Replies: 8
    Last Post: 11-08-2011, 01:26 PM
  6. Finding the position of data item in a list
    By jk1 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-28-2011, 05:24 AM
  7. Taking the next item in a list into 1 of 2 tables based on the previous item time
    By SoleAris in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2011, 04:59 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