Condition Formating

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,208
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
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
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).
 

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,208
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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
Something like:
Code:
=AND($D2-$K2<=2,$D2<>0,$K2<>0)
which also check to make sure both D and K are not blank.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
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>
 

Watch MrExcel Video

Forum statistics

Threads
1,122,511
Messages
5,596,581
Members
414,079
Latest member
Frills

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
Top