Conditional formatting for groups

G

Guest

I have an Excel list where the first column identifies a group, like
1
1
1
3
4
4
6
6
6
Now I want to color the rows of the groups alternating for better readability.
Group 1 (the rows starting with 1) - red
Group 2 (the rows starting with 3) - blue
Group 3 (the rows starting with 4) - red
Group 4 (the rows starting with 6) - blue
....and so on

The numbers in this list are not in sequence and have gaps.
The number of rows belonging to a group differs from group to group.

Any smart and experienced guy out there who can help?
 
J

Jason Morin

Requires a helper column...

1. Assuming your groups are in col. B, place a 1 in A1
and copy the following into A2:

=(B2<>B1)*(A1<>1)+(B2=B1)*A1

Copy this formula all the way down to your last row.

2. Select all the rows with data.
3. Go to Format > Conditional Formatting.
4. Under Condition 1, choose "Formula Is" and use:

=$A1=0

5. Press the Format button, click on a color off the
Pattern tab, and press OK.
6. Click Add, Formula Is, and use:

=$A1=1

7. Press the Format button and choose another color.

HTH
Jason
Atlanta, GA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top