Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Change Row color at every change in value (non consecutive)

In Excel, I want to change the color of the row at every change in a particular row value. The changed rows could be non-consecutive.

For example:

Customer Product Line  Product

1        Outdoor       Lawn Jarts
1        Indoor        Nerf Hoops
2        Outdoor       Ball Game
3        Indoor        Fort Builder
4        Indoor        Twist'Em
4        Indoor        Silly Silly

In this example, I would want customer 1 to be light blue; customer 2, white; customer 3 light blue; customer 4, white, repeating at every customer change.

Color Change Excel

I'd prefer to use a formula if possible. Thanks.

EDIT: Customer numbers are non-consecutive numbers (1,15,49406, etc.)

like image 649
jabs Avatar asked Sep 01 '25 16:09

jabs


1 Answers

Starting in A2, highlight the Range A2:C7 (Or whatever range necessary) and then create a New Rule in the Conditional Formatting Rules Manager. Select "Use a formula to determine which cells to format" and enter this formula:

=MOD(SUM(IF(FREQUENCY($A$2:$A2,$A$2:$A2)>0,1)),2)=1

If the customer numbers include text, you can use:

=MOD(SUM(IF(FREQUENCY(MATCH($A$2:$A2,$A$2:$A2,0),MATCH($A$2:$A2,$A$2:$A2,0))>0,1)),2)=1
like image 141
rwilson Avatar answered Sep 04 '25 06:09

rwilson