conditional format on date

Peter1973

Well-known Member
Joined
May 13, 2006
Messages
963
Office Version
  1. 365
Hi I am trying to get a formula for a conditional format to look in A1 and if the date is less than 14 days away from today then go amber and if it is less than 7 days away from today go red.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
You can do this with Conditional Formatting formulas:

For red:
Code:
=AND(A1-TODAY()<7,A1-TODAY()>=0)

For amber:
Code:
=AND(A1-TODAY()<14,A1-TODAY()>=7)
 
Upvote 0
Hi I am trying to get a formula for a conditional format to look in A1 and if the date is less than 14 days away from today then go amber and if it is less than 7 days away from today go red.
I'll assume that "away from" today means on either side of today, as opposed to "before" today or "after" today. You can adjust the formulas below to suit the latter cases.
1st rule CF formula:
=ABS(TODAY()-A1) < 7
2nd rule CF formula:
=ABS(TODAY()-A1) < 14
 
Upvote 0
Just note some subtle differences to our responses, and be aware how Excel handles these.

- I assumed you were talking about future dates (so A1 would hold future dates). JoeMo assumed past dates (so A1 would hold past dates). Whichever one is bigger needs to be first in the subtraction expression.
- I included a date range, so order of the Conditional Formatting rules does not matter. JoeMo only checks the end date, so order does matter. And note that when entering CF rules, Excel does it in reverse order so that the LAST condition you enter is the 1st priority. The good news is that if you do happen to enter them in the wrong order, it is easy to edit the rules and re-order them.
 
Last edited:
Upvote 0
Just note some subtle differences to our responses, and be aware how Excel handles these.

- I assumed you were talking about future dates (so A1 would hold future dates). JoeMo assumed past dates (so A1 would hold past dates).
Actually, I assumed that "away from" today includes both dates before today and dates after today as I stated in my post. :)
 
Upvote 0
Actually, I assumed that "away from" today includes both dates before today and dates after today as I stated in my post.
Ah yes, I was just looking at the formulas and overlooked the ABS part of the formula! Sorry for the confusion!:oops:
 
Upvote 0
Ah yes, I was just looking at the formulas and overlooked the ABS part of the formula! Sorry for the confusion!:oops:
Thanks, just wanted the OP to recognize that choice of words can be important. In this case, "away from today" can be either, or both of, "before today" and "after today". :)
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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