Conditional Formatting and Dates


Posted by Tim Harrington on November 20, 2001 7:10 AM

I would like to add conditional formatting to a cell based on whether the cell date is earlier (less than) or later (greater than) as compared to a date in another cell. I want to format the cell to change color depending on whether the cell value is less than or greater than the date in the cell being compared against. I realise you can't just subtract A1 from B1 and get the correct date. I know that you have to use Date (Year(A1), Month(A1), Day(A1)) to get A1's calendar equivalent and then you have to use conditional formatting in the comparison cell (B1 for example) to determine whether or not the cell is less than or greater than the calander date in A1. I have used the conditional formatting as follows: If cell value is less than DATE (YEAR(A1), MONTH(A1), DAY(A1)-45) then format the cell to change to purple. This works but when the date of B1 cell is greater than the date of A1 the B1 cell remains purple.

In a nutshell, all I want to do is change the color of a cell based on whether not it is before or after a date in another cell minus 45 days. For example A1 cell has the date of 11/20/01. 11/20/01 minus 45 days will deliver a date of 10/06/01. I want to conditional format B1 cell to change the color of the cell based on whether the date in B1 cell is before or after 10/06/01. If before 10/06/01 make the cell purple, if after 10/06/01 then format no color shading to the cell. But it has to change based on the date in A1 cell minus 45 days. So whatever date is in A1, B1 will be compared to that date minus 45 days in order to change the shading in B1 cell.

Clear as mud? Me too.



Posted by Aladin Akyurek on November 20, 2001 7:26 AM

Did you try:

=B1<=($A$1-45)

Aladin

=========