Home > database >  Format table rows based on the value in specfic column changing in excel
Format table rows based on the value in specfic column changing in excel

Time:09-06

I have a table with an employee appearing in the first column multiple times, I'd like to colour all rows as the employee name changes. Here's an example of what I'd like to achieve -

Table Formatting

I use the following conditional formatting formula for colouring every other row (if there is data) in a different table when I know the data will be changing every row. Is there something similar I can use to only change the colour if the item in the first column changes?

=AND($A2<>"",MOD(ROW(),2)=0)

CodePudding user response:

I would use a helper column as well - but calculating the "ID" of the employee. Formula in C2

=IF(A2<>A1,SUM(C1,1),C1)

enter image description here

Then you can use the same logic as you showed us in your question: =MOD($C2,2)=0 as your format condition.

CodePudding user response:

I would use a helper column which checks whether the name in the current row is different to the previous one or not. Then use this column in a simple conditional formatting.

=IF(B4<>B5,1-SUM(A4),SUM(A4))

enter image description here

  • Related