conditional fomatting

mas550

New Member
Joined
Jan 4, 2011
Messages
20
i am looking for an easy way to alternate the colors of the cells every time the value within the cell changes...
a
a
a
d
d
h
h
i
i
f
s

i need all the a's green and the d's yellow and the h's red again

the cells are cutomer names not letters
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
i need all the a's green and the d's yellow and the h's red again
Red again? Where was red mentioned in the first place?
Are you alternating between two or three colors?

If you can make use of a "helper" column, I know of a way to do this.
Say your data begins in cell A1. Enter this formula in B1 and copy down for all rows:
Code:
=SUMPRODUCT((A$1:A1<>"")/COUNTIF(A$1:A1,A1:A$1&""))

Now, highlight all rows and select Conditional Formatting, and choose the formula option, and enter this formula in for condition 1:
=mod($b1,2)=1
and select your green color formatting.
Now, add a second condition with this formula:
=mod($b1,2)=0
and select your yellow formatting.

This works for two colors. If you have three, you would just use three conditions, i.e.:
=mod($b1,3)=2
=mod($b1,3)=1
=mod($b1,3)=0
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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