# rank top 5 high

1. ## 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. ## 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

3. ## Re: rank top 5 high

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

4. ## 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.``

5. ## Re: rank top 5 high

Thank you newdoverman!

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

6. ## 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:
`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. ## Re: rank top 5 high

Got it! Thanks again

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

#### 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