Highlighting cells

HaroldDavis

New Member
Joined
Aug 15, 2011
Messages
29
Hi,

I have 2 columns with dates. I want to highlight a third column if there is less than 21 days between the two dates (e.g. below).

<TABLE style="WIDTH: 175pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=233><COLGROUP><COL style="WIDTH: 65pt; mso-width-source: userset; mso-width-alt: 3181" width=87><COL style="WIDTH: 62pt; mso-width-source: userset; mso-width-alt: 2998" width=82><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc 0.5pt solid; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>Apr 26, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc 0.5pt solid; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Jun 23, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc 0.5pt solid; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>Apr 26, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Jun 23, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 3, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Jun 23, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 10, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Jun 23, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 17, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Jun 23, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 10, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Sep 13, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 17, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Sep 13, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>Apr 29, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 width=82 align=right>Oct 20, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc 0.5pt solid; BACKGROUND-COLOR: #eeeeee; WIDTH: 65pt; HEIGHT: 12.75pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl66 height=17 width=87 align=right>May 31, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 62pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl67 width=82>Apr 5, 2011</TD><TD style="BORDER-BOTTOM: #cccccc 0.5pt solid; BORDER-LEFT: #cccccc; BACKGROUND-COLOR: #eeeeee; WIDTH: 48pt; BORDER-TOP: #cccccc; BORDER-RIGHT: #cccccc 0.5pt solid" class=xl65 width=64>shipped</TD></TR></TBODY></TABLE>

Thanks.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You should be able to use Conditional Formatting for that.
While in your third column, hit the menu for Format > Conditional Formatting.
For the Condition, choose Formula Is
For the formula, use (something like) =B1-A1<21 and then format to suit.
Use the Format Painter to copy the formatting to the rest of your range of interest.

(At least that's how you can do it in xl'03)
Hope it helps
 
Upvote 0
Thanks, that's the first thing I tried but it didn't work. All of the cells ended up being highlighted. I'm using Excel 07.
 
Upvote 0
Thank you. I finally got it to work. There was some glitch in the way the numbers were set up that made it not work originally.
 
Upvote 0

Forum statistics

Threads
1,222,415
Messages
6,165,896
Members
451,993
Latest member
rowebca

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