ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional formatting two rows at a time (https://www.excelbanter.com/excel-programming/342603-conditional-formatting-two-rows-time.html)

Mike K[_4_]

Conditional formatting two rows at a time
 
Given a data set of the following:

City, Some number
Atlanta, 4
Altanta, 7
Dallas, 3
Dallas, 1
Toronto, 8
Toronto, 10
Trenton, 12
Trenton, 1

Can I do conditional formatting so that each set of two rows has
alternating colors? For example, the two rows with Atlanta are
highlighted yellow, Dallas white, Toronto yellow, Trenton white.


Dave Peterson

Conditional formatting two rows at a time
 
Maybe use format|conditional formatting.

Select your range A2:Bxxx (headers in row 1??)

Then with A2 the activecell
format|conditional formatting
formula is:
=MOD(ROW(A2),4)<2
And give it a nice yellow pattern.

Mike K wrote:

Given a data set of the following:

City, Some number
Atlanta, 4
Altanta, 7
Dallas, 3
Dallas, 1
Toronto, 8
Toronto, 10
Trenton, 12
Trenton, 1

Can I do conditional formatting so that each set of two rows has
alternating colors? For example, the two rows with Atlanta are
highlighted yellow, Dallas white, Toronto yellow, Trenton white.


--

Dave Peterson

Mike K[_4_]

Conditional formatting two rows at a time
 
Perfect, thanks so much Dave.


David McRitchie

Conditional formatting two rows at a time
 
If A2 is the active cell for
=MOD(ROW(A2),4)<2
you could simply code as
=MOD(ROW(),4)<2
for exactly the same meaning and effect.


"Dave Peterson" wrote in message ...
Maybe use format|conditional formatting.

Select your range A2:Bxxx (headers in row 1??)

Then with A2 the activecell
format|conditional formatting
formula is:
=MOD(ROW(A2),4)<2
And give it a nice yellow pattern.

Mike K wrote:

Given a data set of the following:

City, Some number
Atlanta, 4
Altanta, 7
Dallas, 3
Dallas, 1
Toronto, 8
Toronto, 10
Trenton, 12
Trenton, 1

Can I do conditional formatting so that each set of two rows has
alternating colors? For example, the two rows with Atlanta are
highlighted yellow, Dallas white, Toronto yellow, Trenton white.


--

Dave Peterson




Dave Peterson

Conditional formatting two rows at a time
 
You are correct, sir!

David McRitchie wrote:

If A2 is the active cell for
=MOD(ROW(A2),4)<2
you could simply code as
=MOD(ROW(),4)<2
for exactly the same meaning and effect.

"Dave Peterson" wrote in message ...
Maybe use format|conditional formatting.

Select your range A2:Bxxx (headers in row 1??)

Then with A2 the activecell
format|conditional formatting
formula is:
=MOD(ROW(A2),4)<2
And give it a nice yellow pattern.

Mike K wrote:

Given a data set of the following:

City, Some number
Atlanta, 4
Altanta, 7
Dallas, 3
Dallas, 1
Toronto, 8
Toronto, 10
Trenton, 12
Trenton, 1

Can I do conditional formatting so that each set of two rows has
alternating colors? For example, the two rows with Atlanta are
highlighted yellow, Dallas white, Toronto yellow, Trenton white.


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com