Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Conditionally Formatting for Multiple Date Comparisons.
by Allen Wyatt
(last updated September 13, 2017)
Bev is having a problem setting up a conditional format for some cells. What she wants to do is to format the cells so that if they contain a date before today, they will use a bold red font; if they contain a date after today, they will use a bold green font. Bev cannot get both conditions to work properly.
What is probably happening here is a frustrating artifact of the way that Excel parses the conditions you enter. Follow these steps in to see what I mean:
Figure 1. The New Formatting Rule dialog box.
At this point there is a very good chance that all the dates in the range are formatted as bold red, even if they are a date after today. This is obviously wrong, and it occurs because of how Excel treats what you entered in the New Formatting Rule dialog box.
Display each dialog box again (pull up the Conditional Formatting Rules Manager dialog box, select the rule, and click Edit) and examine what you see. Notice that Excel changed what you entered into the third control for each condition. Instead of appearing as TODAY(), it appears as ="TODAY()". Excel added quotes to what you entered, treating the function name as a string, rather than the actual value for today.
Remove the quote marks, but keep the equal sign, then click on OK. The formatting should now be proper; any dates prior to today will be bold red and any after today will be bold green. If the date is today's date, then it will not be formatted in any particular manner.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12929) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Conditionally Formatting for Multiple Date Comparisons.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Conditional formatting can be used to draw your attention to certain cells based on what is within those cells. This tip ...Discover More
Excel's conditional formatting feature allows you to create formats that are based on a wide variety of criteria. If you want ...Discover More
If you have conditional formatting applied in a worksheet, the formulas in those formats may not be as secure as you would ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.