How to Color Excel Cells Based on Their Last Edited Date
Question details
The user wants to automatically change the background color of Excel cells depending on how recently they were edited, using a color scale like green for within 7 days, orange for 7-30 days, and red for over 30 days.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Tracking the freshness of data in a shared workbook hosted on SharePoint by assigning color codes for recent versus old edits.
- Observed behavior
- Excel does not natively record individual cell edit timestamps through standard formatting. Users must rely on a dedicated date column and correctly formulated conditional formatting rules to achieve the color changes.
Since standard spreadsheet software does not automatically store the last edited date as a cell property, ensure you have a dedicated 'Date' column (e.g., Column E) in your worksheet where the last modified date is entered.
Apply Conditional Formatting Using TODAY() Formulas
Create three separate conditional formatting rules to dynamically change cell colors based on the age of the edit date relative to the current day.
To make cells change color based on elapsed time, you can utilize the TODAY() function within Conditional Formatting. By calculating the difference between the current date and the entered date, the system can determine how many days have passed.
Highlight the cells you want to format. For example, select column E starting from cell E2 down to your last row of data.
Navigate to the Home tab on the top ribbon, click on 'Conditional Formatting', and select 'New Rule' from the dropdown menu.
Choose 'Use a formula to determine which cells to format'. Enter the formula: =AND(TODAY()-E2>=0, TODAY()-E2<=7). Click 'Format', choose a green fill color, and click OK.
Repeat the 'New Rule' process. Enter the formula: =AND(TODAY()-E2>7, TODAY()-E2<=30). Click 'Format', choose an orange fill color, and click OK.
Create a third rule. Enter the formula: =TODAY()-E2>30. Click 'Format', select a red fill color, and click OK to apply all rules.

Automatically Record Edit Dates using VBA
If you want to avoid typing the date manually every time a cell is edited, you can use a VBA macro to automatically insert a timestamp into your date column.
Color Cells Automatically with WPS Spreadsheet
WPS Spreadsheet provides robust Conditional Formatting features that are fully compatible with Microsoft Excel formulas. You can easily set up date-based rules to track workbook updates in a lightweight and highly efficient environment.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your existing spreadsheet containing the dates.
- 2. Highlight the date column: Select the range of cells where you want the color formatting applied.
- 3. Access Conditional Formatting: Navigate to the Home tab and click Conditional Formatting > New Rule.
- 4. Input the TODAY() logic: Select 'Use a formula...', input your specific TODAY() formulas, and set the green, orange, or red colors.
- 5. Apply and track edits: Click OK to apply the formatting. Your spreadsheet will now dynamically update cell colors as days pass.

Frequently Asked Questions
Why isn't my conditional formatting rule working for the whole column?
If you select an entire column but write the formula referencing the wrong starting cell (e.g., using E1 instead of E2 when your selection starts at E2), the rule will misalign. Additionally, ensure you do not use absolute references (like $E$1) in the formula, otherwise, the formatting will evaluate based on that single cell for the entire column.
Can Excel automatically detect when a cell was last modified without a formula?
No, standard spreadsheet formulas cannot read the background modification timestamp of individual cells. You must either manually enter the date, use a VBA macro, or utilize SharePoint/Power Automate scripts to record the exact edit time into a designated cell.
Will these conditional formatting rules update dynamically every day?
Yes. Because the formulas use the TODAY() function, the software will recalculate the difference between the current date and the logged cell date every time the workbook is opened or refreshed, automatically shifting colors as time passes.
Can I use zero in the TODAY() formula for same-day edits?
Yes, writing =AND(TODAY()-E2>=0, TODAY()-E2<=7) correctly includes zero, which represents an edit made on the current date. This ensures cells edited on the exact same day will successfully trigger the 0-7 day formatting rule.




