Excel Tips and Tricks / Business Reporting Question: In Excel 2010, is there a way to automatically highlight upcoming and past due dates?
For example, I have dates that stock will expire in a spreadsheet. I would like Excel to highlight the ones that have expired and those that are 30 days from expiration in green. Is that possible?
Answer: Yes, you can use conditional formatting to achieve exactly what you are looking for
First highlight the range of cells that you want to apply the formatting to. In this example, we've selected all of the dates in Column B.
Select the Home tab in the toolbar at the top of the screen. Then in the Styles group, click on the Conditional Formatting drop-down and select Manage Rules.
When the Conditional Formatting Rules Manager window appears, click on the "New Rule" button to enter the first condition.
When the New Formatting Rule window appears, select Format only cells that contain as the rule type.
Then select Cell Value in the first drop down, less than in the second drop down, and enter the following formula:
=NOW()+30
Next, we need to select what formatting to apply when this condition is met. To do this, click on the Format button.
When the Format Cells window appears, select the Fill tab. Then select the color that you'd like to see the dates that will expire in the next 30 days. In this example, we've selected green. Then click on the OK button.
When you return to the New Formatting Rule window, you should see the preview of the formatting in the Preview box. In this example, the preview box shows green as the fill color. Next click on the OK button.
This will return you to the Conditional Formatting Rules Manager window. Select Ok.
The stock that has already expired and the stock that will expire in less than 30 days from now will be highlighted in green.