Conditional Formatting - Colour Scale Based on Count

marka87uk

Board Regular
Joined
Mar 24, 2007
Messages
247
What would be the best method to add a colour scale to a set of data with a colour scale to indicate how often the value appears in the dataset?

Thanks :)
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You would need a helper column somewhere to do the count, and then use this to determine the colour scale output.
 
Upvote 0
Thanks. I've added a helper section below to count the number of times the values above appear.

I thought I could use the two colour scale, specifying the type as formula and then referencing the helper cells, but I get the error "You cannot use relative references in Conditional Formatting criteria for colour scales, data bars, and icon sets."

It seems like I'm out of luck unless I use a macro to copy the cell colours across on every update?
 
Upvote 0
In the end I settled for making my own colour scale - it's a bit time consuming but at least now I can use the count of cell values without the need for helper cells.

For reference, knowing the maximum count would be around 10, I made a new rule for each value (B1:K31 contain the cells I wanted to use the conditional formatting on) like so:

=COUNTIF($B$1:$K$31,B1)=1 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=2 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=3 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=4 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=5 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=6 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=7 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=8 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=9 - Applies to =$B$1:$K$31
=COUNTIF($B$1:$K$31,B1)=10 - Applies to =$B$1:$K$31

I then used a website to generate the RGB values for a colour scale and applied the corresponding gradient colour to each rule (RGB Color Gradient Maker).
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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