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.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Need to conditionally highlight an entire row based on the contents of a single cell in each row? This tip explains how ...Discover More
Need to have a sound played if a certain condition is met? It is rather easy to do if you use a user-defined function to ...Discover More
Want to know where duplicates are in a list of names? There are a couple of ways you can go about identifying the ...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.