+ Reply to Thread
Results 1 to 8 of 8

Get the top 5 values and associated names

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2011
    Posts
    4

    Lightbulb Get the top 5 values and associated names

    Hi everyone,

    I have a table as below:

    A B C
    Revenue [USD] Status Name
    -----------------------------------------
    $23,250.00 Pending Jack
    $18,600.00 Won Jane
    $9,300.00 Pending Joe
    $9,300.00 Pending James
    $7,750.00 Pending Mike
    $3,990.00 Won Bob
    $3,990.00 Lost Peter
    $3,325.00 Lost Mark
    $3,250.00 Won Mike
    $3,000.00 Won Jones
    $2,660.00 Lost Sarah
    $2,660.00 Lost Cat
    $2,325.00 Won Dean
    $1,995.00 Lost George
    $1,995.00 Pending Lily
    $1,550.00 Won Leona
    $1,445.00 Won Sam
    $1,330.00 Lost Sam
    $1,330.00 Lost Dean
    $1,000.00 Won Jane


    Now i want to get 1)top 5 Amounts that are pending 2)along with the name associated with it.

    I have successfully achieved the task 1 of getting the top 5 pending tasks using the following formula : {=LARGE(IF(B:B="Pending",A:A),ROWS($1:1))}

    Now, coming to the second one, I have used this =INDEX(C:C,MATCH(J26,A:A,0))

    But Amount $9,300 is shown twice, So i need to get two names there.

    Problem.xlsx

    Would appreciate your help.

    Thanks in advance.

  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: Get the top 5 values and associated names

    You need to add a tie-breaker, and by doing this, you can also eliminate the need for an array...

    In a helper column (I used D, it can be hidden or moved), copy this down...
    =IF(B2="pending",A2+COUNTIF($A$2:A2,A2)*0.00001,"")

    Then for the amount, use this...
    =INDEX($A$2:$A$22,MATCH(LARGE($D$2:$D$22,ROW(A1)),$D$2:$D$22,0))
    and then just modify that for the names

    On a side note, try to avoid using entire columns with array formulas, they tend to slow things down
    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
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: Get the top 5 values and associated names

    please see attached and let me know if it works for you?

    It's an array formula so I had to remove your merged cells (try not to use them anyway, if you need to then use the alignment "Center Across Selection")

    Anyway...

    Problem(1).xlsx
    Excel Guru in the making

    <----------If the question has been answered to your satisfication please click the Add Repuation star to the left

  4. #4
    Registered User
    Join Date
    07-14-2011
    Location
    Ha Noi, Viet Nam
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: Get the top 5 values and associated names

    Try this :
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-17-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Get the top 5 values and associated names

    Dear TheCman81,

    Your formula works brilliantly on the excel sheet that is attached. But 1 problem.

    When you precede a value in the table, it displays its name irrespective to its pending or won.
    For ex: Row 5 has the same amount as row 16. but Row 5 is "Won", So its name should not be displayed.

    Also, i was wondering do we have to mention the data range exact to the data ? can i not give C:C instead of $C$2:$C$22.
    Because i am creating a table that reference to various sheets and based on the sheet name, it extracts the data. and every sheet has different number of rows.

    Attached both the sheets
    Deals data.xlsxProblem(1) (1).xlsx


    Thanks

  6. #6
    Registered User
    Join Date
    10-17-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Get the top 5 values and associated names

    Thanks Sunflower, Can you please explain how you have done this.

    Cheers

  7. #7
    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: Get the top 5 values and associated names

    did you try my suggestion in post #2?

  8. #8
    Registered User
    Join Date
    10-17-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Get the top 5 values and associated names

    Oh Sorry, Just saw this.. Will try it and get back to you. thanks for you response.

+ 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] Match names and sum the 2 values from matched names
    By score in forum Excel General
    Replies: 3
    Last Post: 09-11-2012, 01:12 AM
  2. [SOLVED] HELP: Get top X values as column names not as values themselves ?
    By Mr.Nob0OOdy in forum Excel General
    Replies: 13
    Last Post: 06-18-2012, 08:36 AM
  3. Names in Excel Sheet - add values of names only
    By Hitman Hotrods in forum Excel General
    Replies: 4
    Last Post: 11-18-2010, 03:46 PM
  4. Changing Sheet Names Based on # Values in Names
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2010, 03:34 PM
  5. Replies: 0
    Last Post: 08-25-2005, 02:17 AM

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