totn Excel

MS Excel 2003: Automatically highlight expired dates and dates that are 30 days from expiration

This Excel tutorial explains how to use conditional formatting to automatically highlight expired dates and dates that are 30 days from expiration in Excel 2003 and older versions (with screenshots and step-by-step instructions).

Question: In Microsoft Excel 2003/XP/2000/97, is there a way to automatically highlight upcoming and past due dates?

For example, I have dates that certificates will expire in a spreadsheet. I would like Excel to highlight the ones that are 30 days from expiration in yellow and the ones that are past the expiration in red. 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 column A since we don't know how many rows will have expiration date values.

Next, under the Format menu, select Conditional Formatting.

Microsoft Excel

When the Conditional Formatting window appears, select "Formula Is" in the drop down. Then enter the following formula that uses the ISBLANK function:

=ISBLANK(A1)=TRUE

What this formula means is that if any cells in column A are blank, do not apply any formatting. The value of A1 is put as the parameter in the ISBLANK function since this is the first value in the range of cells that you've selected. Since the formula uses relative referencing each value in column A will be evaluated individually.

Next, click on the Add button to create a second condition.

Microsoft Excel

In Condition 2, select "Cell Value Is" in the first drop down and "less than" in the second drop down. Then enter the following formula that uses the NOW function:

=NOW()

What this formula means is that if the date in the cell is past today's date, then apply the formatting in Condition 2.

Next, click on the Format button for Condition 2.

Microsoft Excel

When the Format Cells window appears, select the Patterns tab. Then select the color that you'd like to see the expired dates displayed in. In this example, we've selected red. Then click on the OK button.

Microsoft Excel

When you return to the Conditional Formatting window, you should see the following. Next, click on the Add button again to create a third condition.

Microsoft Excel

For Condition3, select "equal to" in the second drop down. Then enter the following formula that uses the NOW function:

=NOW()+30

Then click on the Format button for Condition 3.

Microsoft Excel

When the Format Cells window appears, select the Patterns 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 yellow. Then click on the OK button.

Microsoft Excel

Your Conditional Formatting window should now look like this:

Microsoft Excel

Click on the OK button.

Now when you return to the spreadsheet, the conditional formatting will be applied.

Since we created this example on 20/09/2007, you can see that the value in cell A4 will expire in the next 30 days, while the value in cell A5 has already expired.

Microsoft Excel