+ Reply to Thread
Results 1 to 7 of 7

Trying to lookup name with reference to salary amount...with duplicate salaries.

  1. #1
    Registered User
    Join Date
    03-18-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    4

    Trying to lookup name with reference to salary amount...with duplicate salaries.

    Here is the problem I am faced with,
    I am trying to figure out the players with the highest salaries, so I have the highest salaries of the year already located and in column N. I am trying to lookup which player earns each of these salaries, but when I run into duplicate salaries, it will only return the first person in the list of players with that salary for each cell (I know that is how index/match works). So I tried the formula in the formula bar to combat this issue, but I don't know why it won't work. What I'm basically trying to say with this formula is...If there are more than one of the same salary, use this complicated function to lookup the player, if not, use the simple index/match function. The formula in the [value if true] section works (that is why the highlighted cells appear to be the correct players), but only with the players with duplicate salaries. I can not just use that formula for the whole list. So what I have done in column M is used the simple index/match formula for unique salary values and used the longer formula for duplicate salary values. But, I want this to all be in one formula that I can drag for the whole list in the interest of time because as you can see, I have to do this for multiple years. I do not know why I get errors when I use this formula for the rest of this list (column O). Any help is appreciated.
    Capture.PNG

  2. #2
    Forum Contributor
    Join Date
    08-14-2018
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2016
    Posts
    118

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    Try
    M2=INDEX($B$2:$B$29,MOD(LARGE(INDEX(ROW($B$2:$B$29)+$C$2:$C$29*1000,),ROW(A1)),1000)-1)

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    An uploaded copy of a cutdown version of the workbook would be more useful to enable a solution to be found for you.
    torachan.

  4. #4
    Registered User
    Join Date
    03-18-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    4

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    This worked, but the names with duplicate salaries get matched from bottom of the list to the top (last to first person with the same salary). This isn't a problem, just curious as to why it did that.

  5. #5
    Registered User
    Join Date
    03-18-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    4

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    Quote Originally Posted by congnt92 View Post
    Try
    M2=INDEX($B$2:$B$29,MOD(LARGE(INDEX(ROW($B$2:$B$29)+$C$2:$C$29*1000,),ROW(A1)),1000)-1)
    This worked, but the names with duplicate salaries get matched from bottom of the list to the top (last to first person with the same salary). This isn't a problem, just curious as to why it did that.

  6. #6
    Registered User
    Join Date
    03-18-2019
    Location
    USA
    MS-Off Ver
    2019
    Posts
    4

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    Quote Originally Posted by torachan View Post
    An uploaded copy of a cutdown version of the workbook would be more useful to enable a solution to be found for you.
    torachan.
    Will do from now on. Thanks.

  7. #7
    Forum Contributor
    Join Date
    08-14-2018
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2016
    Posts
    118

    Re: Trying to lookup name with reference to salary amount...with duplicate salaries.

    Quote Originally Posted by jm22yanks View Post
    This worked, but the names with duplicate salaries get matched from bottom of the list to the top (last to first person with the same salary). This isn't a problem, just curious as to why it did that.
    Since there are many people with same salary, using match or vlookup formula always return the first match. Index formula is very useful in this case.
    ROW($B$2:$B$29)+$C$2:$C$29*1000 returns a vector like this (assume that the salary is 2,430) {2,430,001 ; 2,210,002 ; 2,430,003}
    Large() will then sort these values like this {2,430,003 ; 2,430,001 ; 2,210,002}
    Using Mod(,1000) to get back the row number then Index formula does its job.
    This causes we get the list that matched from bottom to the top.
    If you want to avoid it then try (not tested)
    Please Login or Register  to view this content.
    Last edited by congnt92; 03-19-2019 at 04:25 AM. Reason: code tag

+ 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: 7
    Last Post: 08-29-2018, 08:28 AM
  2. Replies: 1
    Last Post: 11-22-2017, 05:27 AM
  3. [SOLVED] Salary amount from multi criteria tables
    By julesmctavish in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-20-2015, 03:18 PM
  4. [SOLVED] Need formula for prorating monthly salary based on hire/fire date and annual salary.
    By Excel_Help_Pls in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-06-2015, 12:56 AM
  5. Replies: 1
    Last Post: 05-27-2014, 07:00 AM
  6. Replies: 2
    Last Post: 05-27-2014, 01:17 AM
  7. Replies: 6
    Last Post: 05-07-2006, 09:10 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