Formatting Issues

Fix Excel Conditional Formatting for Dates Older Than 30 Days

Aamir Naveed AkramAamir Naveed Akram Nov 18, 2026 870 views

Question details

The user needs to highlight dates more than 30 days before today with an Excel conditional formatting rule.

Fix Excel Conditional Formatting for Dates Older Than 30 Days
Product
Microsoft Excel
Device & OS
not provided
Scenario
Apply a date-based formatting rule to a range beginning at G2.
Observed behavior
The expression =G2[=TODAY()-30 contains an invalid comparison operator and cannot be used as written.
Before you start

Identify the first cell in the range you want to format and check that the dates are stored as actual Excel dates rather than text. The examples below assume the range begins at G2.

Solution 1Recommended

Use a Formula Rule for Dates Older Than 30 Days

Use this rule to highlight numeric dates before the 30-day cutoff while ignoring blank and text cells.

1
Select the date range

Select the cells to format, such as G2:G1000, starting with G2.

2
Create a formula rule

On the Home tab, choose Conditional Formatting > New Rule, then select Use a formula to determine which cells to format.

3
Enter the formula

Enter =AND(ISNUMBER(G2),G2<TODAY()-30). Keep G2 relative so Excel evaluates each row against its own date.

4
Choose the formatting

Select Format, choose a color on the Fill tab, and click OK. Click OK again to create the rule.

5
Check the applied range

Open Conditional Formatting > Manage Rules and confirm that Applies to starts at G2, for example =$G$2:$G$1000. Remove the invalid rule if it is still present.

Use a Formula Rule for Dates Older Than 30 Days
The cutoff is exclusive: The less-than operator excludes a date exactly 30 days before today. Use <= instead of < if that date should also be highlighted.
WPS Spreadsheets

Highlight Older Dates in WPS Spreadsheets

Use a formula-based conditional formatting rule in WPS Spreadsheets to highlight dates before a rolling 30-day cutoff.

  1. 1. Open the spreadsheet: Open WPS Spreadsheets and use File > Open to select your workbook.
  2. 2. Select the date range: Select the cells you want to format, such as G2:G1000.
  3. 3. Add the formula rule: On the Home tab, open Conditional Formatting > New Rule, choose the formula-based rule, and enter =AND(ISNUMBER(G2),G2<TODAY()-30).
  4. 4. Choose a format: Click Format, choose a fill color, and confirm the rule. Check that its applied range starts at G2.
Highlight dates older than 30 days with a TODAY-based ruleOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceGet started with WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Why does my conditional formatting formula fail?

The expression =G2[=TODAY()-30 contains an invalid operator. In Home > Conditional Formatting > Manage Rules, edit the rule and replace it with =AND(ISNUMBER(G2),G2<TODAY()-30) for a range starting at G2.

How do I include dates exactly 30 days old?

Use =AND(ISNUMBER(G2),G2<=TODAY()-30) in the formula rule. The <= operator includes the cutoff date.

Why are some dates not highlighted?

Check that the entries are actual date values, not text, and that the formula refers to the first cell in the applied range. Review the range under Home > Conditional Formatting > Manage Rules.

Will the highlighted dates change as time passes?

Yes. TODAY() uses the current date, so the cutoff moves as the workbook recalculates. If needed, use the Formulas tab to check Excel's calculation settings.