+ Reply to Thread
Results 1 to 6 of 6

How to get the name related to the price?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    How to get the name related to the price?

    Dear all,

    I have a task to rank the stocks from the highest price to the lowest price. I've made a template and managed to get the ranking right. I used the LARGE() function.

    But now the difficulty is to get the 'Stock name' related to the ranked price. I may do it with the MATCH() function. But the problem is there is an equal number 15%.

    Can you have a look at the example attached here?
    Attached Files Attached Files

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

    Re: How to get the name related to the price?

    hi billj, try this array formula:
    =INDEX($A$2:$A$11,SMALL(IF($C$2:$C$11=H6,ROW($C$2:$C$11)-ROW($C$2)+1),COUNTIF(H$6:H6,H6)))

    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

  3. #3
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: How to get the name related to the price?

    Quote Originally Posted by benishiryo View Post
    hi billj, try this array formula:
    =INDEX($A$2:$A$11,SMALL(IF($C$2:$C$11=H6,ROW($C$2:$C$11)-ROW($C$2)+1),COUNTIF(H$6:H6,H6)))
    Hi benishiryo, your formula works nicely thanks for your great idea and help.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to get the name related to the price?

    Quote Originally Posted by billj View Post
    Hi benishiryo, your formula works nicely thanks for your great idea and help.
    Hmmm...

    Are you sure that formula works? I get these results with that formula:

    Microsoft
    Johnson & Johnson
    IBM

    I think these are the correct results:

    Microsoft
    Johnson & Johnson
    Goldman Sachs

    This array formula** entered in I6 and copied down:

    =IF(H6="","",INDEX(A:A,SMALL(IF(B$2:B$11=H$2,IF(D$2:D$11=H$3,IF(E$2:E$11=H$1,IF(C$2:C$11=H6,ROW(C$2:C$11))))),COUNTIF(H$6:H6,H6))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: How to get the name related to the price?

    Quote Originally Posted by Tony Valko View Post
    Hmmm...

    Are you sure that formula works? I get these results with that formula:

    Microsoft
    Johnson & Johnson
    IBM

    I think these are the correct results:

    Microsoft
    Johnson & Johnson
    Goldman Sachs

    This array formula** entered in I6 and copied down:

    =IF(H6="","",INDEX(A:A,SMALL(IF(B$2:B$11=H$2,IF(D$2:D$11=H$3,IF(E$2:E$11=H$1,IF(C$2:C$11=H6,ROW(C$2:C$11))))),COUNTIF(H$6:H6,H6))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Hi, Tony. Yes, I noticed that the formula needs to be adjusted. I did that and got the right answer. The principle is right though.

    Thanks for help

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to get the name related to the price?

    Good deal. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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