Conditional formatting different number = different color going down column

svendiamond

Well-known Member
Joined
Jun 13, 2014
Messages
1,504
Office Version
  1. 365
Platform
  1. Windows
I have a very simple conditional formatting problem. I have a table like this:

riYXrdD.jpg


I want to have each new door number's row be highlighted, for example the first one 114 can be white, and the next one 115 gray, then 122 white, 123 gray, 129 white, 130 gray... etc etc...

AKA I want it to look like this:

7xt7uB9.jpg


There's got to be an easy way to do this, right?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Select A2:B1000 (if rows extend below 1000 adjust accordingly)
Click Home - Conditional Formatting - New Rule
In the window that pops up, click "Use a formula to determine which cells to format"
Enter this formula in the box below "Format values where this formula is true"
Code:
=IF($A2<>"",ISEVEN(SUM(IF(FREQUENCY($A$2:$A2,$A$2:$A2)>0,1))))
Click the "Format" button
On the Fill tab, select a color, then click OK, OK

This assumes only numbers (no text) in your col A data
 
Last edited:
Upvote 0
Select A2:B1000 (if rows extend below 1000 adjust accordingly)
Click Home - Conditional Formatting - New Rule
In the window that pops up, click "Use a formula to determine which cells to format"
Enter this formula in the box below "Format values where this formula is true"
Code:
=IF($A2<>"",ISEVEN(SUM(IF(FREQUENCY($A$2:$A2,$A$2:$A2)>0,1))))
Click the "Format" button
On the Fill tab, select a color, then click OK, OK

This assumes only numbers (no text) in your col A data

Thanks for the response. I tried your solution and it highlights my entire table. I've done this before with door numbers in order like 114, 115, 116, 117, where I can do a simple =ISEVEN($A2) for the conditional formatting and it will only highlight the rows with even door numbers... but on this list, the door numbers jump from 115 to 118, then 127, or whichever ones are currently in use. I need to highlight every other row of different door numbers. That way it will be easier to see all the information for each door. Thanks for the help and any other solution you can provide.
 
Upvote 0
It works properly for me. Are your Col A numbers formatted at text? Can you upload your file to a file sharing service so I could download it without a password?
 
Upvote 0
I think the issue is a simple type in Rob's first response, "Select A2:B1000" should be A2:A1000"
 
Upvote 0
I think the issue is a simple type in Rob's first response, "Select A2:B1000" should be A2:A1000"
Both Col A & B are included so that both are highlighted when the condition calls for it. Note the placement of $'s in front of the A so the formula will be the same for both Col A & B.

Svendiamond,
Also make sure any previous conditional formats you might have used have been cleared.

Ron
 
Upvote 0
It works properly for me. Are your Col A numbers formatted at text? Can you upload your file to a file sharing service so I could download it without a password?

Ah, sorry. You were right. My numbers were formatted as text. The code works correctly. Thank you.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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