Conditional Formatting with borders & colors

rmccafferty

Board Regular
Joined
Jul 16, 2009
Messages
60
I had hoped I could attach a file so this would be easier to show with a complete example.

I have a column of numbers with a total at the bottom. I used borders to put boxes around each cell, with the totals box in heavier lines. That is I but an "all sides" border on the entire list and total cells, then selected the totals cell and put a heavy border around it. (I tried to copy it below, but the paste does not show the black borders.)

Then I put conditional formatting in the cell with the number 6 so that any number over 5 had a red border (my own usage is a bit more complicated, but the issue is identical). In the paste below, the red border on all sides shows. In the spreadsheet (using Excel 2007), all the cells show the black border except the cell with the number 6. Inexplicably to me, that cell has red on the two sides but black on the top and bottom lines. (Yes, I am sure that in the conditional formatting I selected all 4 sides for the red lines). Obviously, there is a conflict in that the cell with the 5 in it (as well as the one with the total) call for a black top and bottom, while the cell with the 6 in it calls for a red top and bottom. And the black line is taking precedence.

Is there a way to make the red border around the number 6, with the conditional formatting, take precedence for a complete red border on that cell?

<table width="64" border="0" cellpadding="0" cellspacing="0"><col style="width:48pt" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt; width:48pt" width="64" align="right" height="20">1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;border-top:none" align="right" height="20">2</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;border-top:none" align="right" height="20">3</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;border-top:none" align="right" height="20">4</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;border-top:none" align="right" height="20">5</td> </tr> <tr style="height:15.75pt" height="21"> <td class="xl64" style="height:15.75pt;border-top:none; border:.5pt solid red" align="right" height="21">6</td> </tr> <tr style="height:15.75pt" height="21"> <td class="xl65" style="height:15.75pt" align="right" height="21">21</td> </tr> </tbody></table>
To test my logic in this, I changed the conditional format to have a red border for every number over 4 and pasted the format into all the cells. That resulted in the following (with black borders around all cells that do not show as red here, again a hangup in the copy-paste process):

<table width="64" border="0" cellpadding="0" cellspacing="0"><col style="width:48pt" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt; width:48pt" width="64" align="right" height="20">1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">2</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">3</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" align="right" height="20">4</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border:.5pt solid red" align="right" height="20">5</td> </tr> <tr style="height:15.75pt" height="21"> <td class="xl65" style="height:15.75pt;border:.5pt solid red" align="right" height="21">6</td> </tr> <tr style="height:15.75pt" height="21"> <td class="xl66" style="height:15.75pt" align="right" height="21">21</td> </tr> </tbody></table>
So again, how can I make the red lines show on all 4 sides while cells above an below have their black lines only on 3 sides? If anyone wants to see the simple spreadsheet I made as an example, I am happy to forward it.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,521
Messages
6,179,287
Members
452,902
Latest member
Knuddeluff

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