# Shading groups of rows based on changing text values

I would like to alternate the shading of a group of rows each time the text value of a column changes. So all rows with "abc" in column B, will be shaded blue, when the value of column B changes to "def", the rows will be shaded green. The the next time the value of column B changes, the next group of rows will be shaded blue, etc. Seems like it should be easy, but I have not figured it out! I am on a Mac using excel 2008.

• Thank you, but that is not exactly what I am trying to do. I have sorted by the value in column B. So all rows with "abc".are grouped together followed by all rows with "def", then "xyz". So I would just like to easily be able to see the grouping of rows where the values in column be are the same and, using just two colors, alternately delineate the change. So if I have a list of names, address and phone numbers and sort them by everyone that lives in the same city, then I can easily see the groups when the city changes. – Linda Topper Jul 9 '15 at 14:23
• So regardless of how many cities, you want only two colors, and you want them to alternate whenever the city changes. Am I understanding that correctly? – Clif Jul 10 '15 at 23:03
• I have updated my answer. – Clif Jul 11 '15 at 0:05

• Populate the next cell with the formula `=IF(B3=B2,E2,E2+1)`, and copy down,