Highlight Top 3 Value/s with Ties

papajups

Board Regular
Joined
Sep 8, 2012
Messages
166
I have column A with a list of numbers, and I am trying to highlight the top 3 highest value/s. However, conditional formatting is not working properly if there are duplicate values.

Highest value/s – Color Blue
2nd Highest value/s – Color Yellow
3rd Highest value/s – Color Green
Other Values should be empty (no color)

A1=5
A2=5
A3=5
A4=4
A5=4
A6=4
A7=3
A8=3
A9=3
A10=2
A11=1
A12=0

From the above example, cells A1:A3 must be highlighted in ‘blue’, while A4:A6 should be in ‘yellow’, and the a7:a9 should be in ‘green’.

Is there an excel formula or macro to accomplish this?

Your help will be greatly appreciated.


regards,
Papajups
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try this:

Select column A. Click Conditional formatting > New Rule > Use a formula > and enter:

=A1=MAX(A:A)

choose a blue fill color.

Repeat with:

=A1=LARGE(A:A,COUNTIF(A:A,MAX(A:A))+1)

and a yellow fill color, and

=A1=LARGE(A:A,COUNTIF(A:A,">="&LARGE(A:A,COUNTIF(A:A,MAX(A:A))+1))+1)

and a green fill color.
 
Upvote 0
Thank you for your help, Eric.

But what if I only want range A1:A25 to be affected? As i have cell A26 as the Total - it will always be the highest value if I apply the above formulas.


regards,
Papajups
 
Upvote 0
Eric,


Please ignore my previous reply. I was able to tweak the formula.

Big thanks again for your help. I really appreciate it.


regards,
Papajups
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,648
Members
449,177
Latest member
Sousanna Aristiadou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top