Conditional formatting

numaiu

New Member
Joined
Jul 16, 2018
Messages
3
Hello.

I want to make a table that autoamticly changes the row's background color/text color every time the text from the first column changes.
It should look like this:

aaa
row bg color/text color: grey
aaa
row bg color/text color: grey
555
row bg color/text color: red
tttt
row bg color/text color: grey
tttt
row bg color/text color: grey
tttt
row bg color/text color: grey
1212
row bg color/text color: red
1212
row bg color/text color: red
tttt
row bg color/text color: grey
tttt
row bg color/text color: grey

<tbody>
</tbody>

Can this be done ?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Welcome to the Board!

One way would be to use a "helper" column (which you can hide of you want).
Let's say that your data starts in cell A1.
Then in B1, you could enter 1.
Then in B2, enter this formula:
Code:
=IF(A2=A1,B1,B1+1)
and them copy down for all rows.

Then, you could use highlight cells A1 to the bottom, and use these Conditional Formatting formulas:

Condition 1
=ISODD($B1)
choose grey color

Condition 2
=ISEVEN($B1)
choose red color

This should do what you want.
 
Upvote 0

Forum statistics

Threads
1,215,167
Messages
6,123,401
Members
449,098
Latest member
ArturS75

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