Conditional format: alternating row colors .....grouping rows with same ID#

dmj120

Active Member
Joined
Jan 5, 2010
Messages
286
Office Version
  1. 365
  2. 2019
  3. 2010
I've tried several variables, and a few similar web searches, and I can't figure this out.

I'm trying to 'group' rows of varying height to alternate between two colors. This is the best so far..... thoughts :unsure:


1683591125058.png
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Rather than posting an image, please use XL2BB to show your sample data and expected results to that anyone trying to help you doesn't have to retype or try to recreate your information.
 
Upvote 0
Can you get by with a helper column? If so, try something like this which uses a helper column E?

1683595020745.png


Where column E is the helper and is the following with E2 set to a 1:

Book1
E
21
31
42
52
62
72
83
94
104
114
Sheet4
Cell Formulas
RangeFormula
E3:E11E3=IF(A2=A3,E2,E2+1)
 
Upvote 0
Just a small variation on @kweaver's suggestion, also using a helper column (that could be hidden)
I2:I16 all coloured the light blue manually and the Conditional Formatting over-rides that in the relevant rows, so you only need one CF rule.

Conditional Format in Groups.xlsm
IJ
1Food0
2Cake1
3Cake1
4Cake1
5Cake1
6Cake1
7Pie0
8Pie0
9Pie0
10Donut1
11Donut1
12Donut1
13Donut1
14Donut1
15Donut1
16Donut1
Cond Format In Groups
Cell Formulas
RangeFormula
J2:J16J2=IF(I2=I1,J1,1-J1)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:I16Expression=$J2textYES
 
Upvote 1
Solution
Another option
Fluff.xlsm
ABC
1Code
2a
3a
4a
5b
6b
7b
8c
9c
10d
11e
12e
13f
14
15
16
Main
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C16Expression=AND($A2<>"",MOD(SUMPRODUCT(--($A$2:$A2<>$A$1:$A1)),2))textNO
 
Upvote 1
Just a small variation on @kweaver's suggestion, also using a helper column (that could be hidden)
I2:I16 all coloured the light blue manually and the Conditional Formatting over-rides that in the relevant rows, so you only need one CF rule.

Thanks, this works perfectly.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,148
Members
449,098
Latest member
Doanvanhieu

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