Custom 160 Row Highlighting

binar

Board Regular
Joined
Aug 20, 2006
Messages
71
Fellow Forum Members,
Can anyone out there PLEASE help me modify the formula below:
=AND(MOD(ROW(),10)<=5,MOD(ROW(),10)<>0)

So that it automatically highlight rows in the pattern outlined below:


Row 1 = White (HEADER ROW)

First group of 160 Rows Highlighted in Yellow

Second group of 160 Rows Highlighted in White

Third group of 160 Rows Highlighted in Yellow

Fourth group of 160 Rows Highlighted in White

Fifth group of 160 Rows Highlighted in Yellow

And so on.

I intend to use this formula as a Conditional Formatting Rule but after playing with it for a long time I'm unable to get color bands that alternate at 160 rows. Any help will be greatly appreciated. Thanks.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Fellow Forum Members,
Can anyone out there PLEASE help me modify the formula below:
=AND(MOD(ROW(),10)<=5,MOD(ROW(),10)<>0)

So that it automatically highlight rows in the pattern outlined below:


Row 1 = White (HEADER ROW)

First group of 160 Rows Highlighted in Yellow

Second group of 160 Rows Highlighted in White

Third group of 160 Rows Highlighted in Yellow

Fourth group of 160 Rows Highlighted in White

Fifth group of 160 Rows Highlighted in Yellow

And so on.

I intend to use this formula as a Conditional Formatting Rule but after playing with it for a long time I'm unable to get color bands that alternate at 160 rows. Any help will be greatly appreciated. Thanks.
Try something like this:

=MOD(CEILING(ROWS(A$2:A2)/16,1),2)
 
Upvote 0
Ooops!

16 should be 160

=MOD(CEILING(ROWS(A$2:A2)/160,1),2)


T. Valko,
Huge thanks for your help ! (Again) I tried out your formula and found it interesting you are using the CEILING function. Never knew such a function existed. Nevertheless, I tried out your formula as a CONDITIONAL FORMATTING RULE and it works with an interesting flaw I can't fix.

ROW 1 is the HEADER row. And the first group of 160 rows count at 159 rows because the HEADER row is being included in the first group of 160 rows. However the second, third, fourth, fifth, etc... group of 160 rows count exactly at 160 rows each.

Is it possible to tweak your equation so that the Header Row1 is not included in the first group of 160 rows? Any help will be greatly appreciated.

Thanks again.
 
Last edited:
Upvote 0
Try this slight modification to Biff's formula:

=MOD(CEILING((ROWS(A$2:A2)-1)/160,1),2)
 
Upvote 0
Try this slight modification to Biff's formula:

=MOD(CEILING((ROWS(A$2:A2)-1)/160,1),2)

Norie,
I tested your formula and it works nicely. The HEADER row is White followed by a group of 160 YELLOW Rows. The count between yellow and white rows is perfect at a 160 rows each. I just wish Microsoft would make such custom row highlighting more easy to setup. This task is very difficult without the help of talented Excel users like you and T. Valko.

Again thanks to all.
 
Upvote 0
T. Valko,
Huge thanks for your help ! (Again) I tried out your formula and found it interesting you are using the CEILING function. Never knew such a function existed. Nevertheless, I tried out your formula as a CONDITIONAL FORMATTING RULE and it works with an interesting flaw I can't fix.

ROW 1 is the HEADER row. And the first group of 160 rows count at 159 rows because the HEADER row is being included in the first group of 160 rows. However the second, third, fourth, fifth, etc... group of 160 rows count exactly at 160 rows each.

Is it possible to tweak your equation so that the Header Row1 is not included in the first group of 160 rows? Any help will be greatly appreciated.

Thanks again.
I see you already have a solution...

Since the header row is a separate condition I assumed you would apply cf to that row as a separate condition and you needed help with the groups of 160 rows.

You would apply the formula I suggested starting on row 2.

Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,462
Members
452,915
Latest member
hannnahheileen

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