Conditional formatting problem

dhaynes

New Member
Joined
Mar 13, 2020
Messages
15
Office Version
  1. 365
Platform
  1. Windows
I am having a conditional formatting issue that I can not seem to solve. The formatting for column with the $ data is working correctly because I simply want to rank and highlight the three highest values.

However, for the column with the % data, I want to rank and highlight the three lowest values, excluding anything equal or less than 0. In other words, I would like to highlight the top three values in the column with the % data (.5%, .5% and 1%).

Here are the functions I have written:
Rule 1: Cells <= 0 fill cell white

Rule 2: =AND(ISNUMBER(C2), COUNTIF(C2:C2,C16)=1, C2=SMALL(IFERROR(1/SIGN(TRANSPOSE(FREQUENCY(MATCH(C2:C16&"",C2:C16&"",0),MATCH(C2:C16&"",C2:C16&"",0)))*ISNUMBER(C2:C16))*C2:C16,FALSE), 1))..fill cell green

Rule 3: =AND(ISNUMBER(C2), COUNTIF(C2:C2,C16)=1, C2=SMALL(IFERROR(1/SIGN(TRANSPOSE(FREQUENCY(MATCH(C2:C16&"",C2:C16&"",0),MATCH(C2:C16&"",C2:C16&"",0)))*ISNUMBER(C2:C16))*C2:C16,FALSE), 2))...fill cell yellow

Rule 4: =AND(ISNUMBER(C2), COUNTIF(C2:C2,C16)=1, C2=SMALL(IFERROR(1/SIGN(TRANSPOSE(FREQUENCY(MATCH(C2:C16&"",C2:C16&"",0),MATCH(C2:C16&"",C2:C16&"",0)))*ISNUMBER(C2:C16))*C2:C16,FALSE), 3))..fill cell red


I have a feeling I may be making this more complicated than need be, but if anyone knows if a solution to this issue, I would be grateful.

1584206914707.png
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I haven't tested this because screen captures can't be copied to excel without retyping the data (xl2bb captures can ;))

If my thinking is correct, this should work for the lowest value greater than zero,

=(COUNTIFS(C$2:C$16,">0",C$2:C$16,"<"&C2)+COUNTIFS(C$2:C2,">0",C$2:C2,C2))=1

Changing =1 at the end to =2 and =3 should work for the others.
 
Upvote 0
Thanks Jasonb75, not only did that work but it is much easier than the path I was going down. You are the man! Having said that, one more requirement comes to mind...can you think of a way to format two cells with the same value. For example, I would like .5% to be formatted with the same color and .75% would be another color. Thank you very much!

Sample data.xlsx
BCD
1Company%$
2A0.50% $100.000
3B0.50% $100.063
4C1.00% $100.094
5D0.75% $100.125
6E2.00% $100.125
7F2.25% $100.156
8G2.50% $100.188
9H2.75% $100.219
10I3.00% $100.250
11J3.25% $100.281
12K3.50% $100.313
13L0.00% $ -
14M3.75% $100.406
15N4.00% $100.438
16O4.25% $100.469
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C16Expression=(COUNTIFS(C$2:C$16,">0",C$2:C$16,"<"&C2)+COUNTIFS(C$2:C2,">0",C$2:C2,C2))=3textNO
C2:C16Expression=(COUNTIFS(C$2:C$16,">0",C$2:C$16,"<"&C2)+COUNTIFS(C$2:C2,">0",C$2:C2,C2))=2textNO
C2:C16Expression=(COUNTIFS(C$2:C$16,">0",C$2:C$16,"<"&C2)+COUNTIFS(C$2:C2,">0",C$2:C2,C2))=1textNO
D2:D16Expression=3=RANK(D2,$D$2:$D$16)textNO
D2:D16Expression=2=RANK(D2,$D$2:$D$16)textNO
D2:D16Expression=1=RANK(D2,$D$2:$D$16)textNO
 
Upvote 0
What would be the correct colour pattern when there are duplicates?

Green, green, yellow? Green, green red? Yellow, yellow, red? Something else?

What if the results were 0.50%, 0.50%, 0.75%, 0.75%, 0.75%? how would you want to format them?
 
Upvote 0
If the highest value in the column with the $ data is formatted is duplicated, all duplicated values will be filled with green. Ideallly the same thing would occur with the column containing the % data with the exception that the lowest number, including any duplicated, would be filled with green. The lowest number would be highlighted yellow and the third red.
If the results were as the suggest, I would want all of the .5% filled with green and all the .75% filled with yellow.
 
Upvote 0
See if this one works for the percentages, change the =1 at the end as before.

=SUMPRODUCT((D2>=$D$2:$D$16)/COUNTIF($D$2:$D$16,$D$2:$D$16))=1

You should be able to use the same for the $ amounts by changing > to <
 
Upvote 0
Thanks, that worked with the exception that it now removed the >0 requirement but I should be able to work that back in
 
Upvote 0
Oops, I thought I had forgotten something

=SUMPRODUCT((A2>=$A$2:$A$16)*($A$2:$A$16>0)/COUNTIF($A$2:$A$16,$A$2:$A$16))
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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