Condition Formating

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello All
I am using Excel 2007 and require help please

I have data in Columns A to T
In column D I have a date Format dd-mm-yyyy
In Column K I also have a date as the same format.

I would like to set a condition format on each row saying the following

D2 - K2
If the answer is = or less than 2 days difference then highlite the whole row Red

This should be easy but I must admit I have a mental block on how to do this so any help would be great please
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Highlight the whole row, then go into Conditional Formatting and select the formula option and enter the formula:
Code:
=$D2-$K2<=2
and then choose your formatting option.

If you highlight all your rows (starting at row 2) at the same time that you do those steps, it should be applied correctly to each row (or you can just do it on row 2 and use the Format Painter to copy down to all other rows).
 
Upvote 0
Joe4
Thank you for your reply, this is working but I have one question, if my rows are blank it also colours the condition format, how can I change the formula to ignore blank cells please
 
Upvote 0
Something like:
Code:
=AND($D2-$K2<=2,$D2<>0,$K2<>0)
which also check to make sure both D and K are not blank.
 
Upvote 0
If you can actually have zeroes, and don't want them treated as blanks, you can make a slight tweak like this:
Code:
=AND($D2-$K2<=2,$D2<>"",$K2<>"")
</PRE>
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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