+ Reply to Thread
Results 1 to 7 of 7

rank top 5 high

  1. #1
    Registered User
    Join Date
    01-18-2016
    Location
    Amsterdam
    MS-Off Ver
    Win8.1
    Posts
    4

    rank top 5 high

    Hi everyone!

    I was looking for a vba code to rank and number in a column but i could'nt find it.
    This is an example of what i want to do (values in column A);

    200% 2
    225% 1
    150% 3
    80%
    125% 4
    25%
    110% 5


    So the code only must insert a ranking of 1 to 5 in column B


    I hope you can help me, thank you!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,038

    Re: rank top 5 high

    Does it have to be VBA?
    Formula solution

    =IF(RANK(A1,A$1:A$7)>5,"",RANK(A1,A$1:A$7))
    and copy down
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    01-18-2016
    Location
    Amsterdam
    MS-Off Ver
    Win8.1
    Posts
    4

    Re: rank top 5 high

    Thanks SpecialK but i really need it in a vba code, do you have that?

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: rank top 5 high

    A recorded macro yielded this result. It can likely be cleaned up and made more efficient by a VBA expert. It is however a start.
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    01-18-2016
    Location
    Amsterdam
    MS-Off Ver
    Win8.1
    Posts
    4

    Re: rank top 5 high

    Thank you newdoverman!

    Do you also know how i can rank the lowest values?

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: rank top 5 high

    The formula is nearly the same as given by Special-K with the 0 at the end being replaced by a 1
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Changing the 0 to a 1 in the macro, should do what you want if you want it in macro form.

  7. #7
    Registered User
    Join Date
    01-18-2016
    Location
    Amsterdam
    MS-Off Ver
    Win8.1
    Posts
    4

    Re: rank top 5 high

    Got it! Thanks again

+ 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. High Low Close Chart - How to add High & Low labels
    By stephenedwardbennett in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-23-2015, 06:45 AM
  2. Rank Teams in Performance Order - not as easy as just =Rank...
    By excelnat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2015, 12:12 PM
  3. Replies: 8
    Last Post: 02-20-2014, 07:03 PM
  4. RANK - Non unique values, contiguous rank required
    By PaulBo in forum Excel General
    Replies: 9
    Last Post: 02-20-2014, 10:34 AM
  5. Replies: 6
    Last Post: 11-30-2013, 09:14 AM
  6. Replies: 1
    Last Post: 11-30-2013, 06:48 AM
  7. Replies: 1
    Last Post: 08-15-2005, 05:05 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