How to Automatically Change Excel Cell Color by Years of Service
Question details
The user needs to automatically color-code employee records in Excel based on their years of service milestones (such as one, three, and five years).

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking employee service milestones where cell formatting updates dynamically as time passes.
- Observed behavior
- To achieve dynamic color-coding based on the current date and the employee's start date without manual updates.
Ensure you have a column containing the employees' start dates formatted correctly as dates in Excel before applying the conditional rules.
Apply Conditional Formatting with Date Formulas
Use the Conditional Formatting feature with EDATE and TODAY functions to dynamically color cells based on elapsed time.
By utilizing the EDATE function in combination with TODAY(), you can calculate exact thresholds for past dates, enabling Excel to format cells when a specific number of months has passed.
Highlight the cells containing the employee start dates that you want to format.
Navigate to the Home tab on the ribbon, click on Conditional Formatting, and select New Rule from the dropdown menu.
Choose 'Format only cells that contain'. Leave the first dropdown as 'Cell Value' and change the second to 'less than or equal to'. In the formula box, enter =EDATE(TODAY(),-12) for employees with one year or more of service.
Click the Format button, go to the Fill tab, select your preferred color for the one-year milestone, and click OK.
Repeat the process to create additional rules for other milestones. For a three-year milestone, use the formula =EDATE(TODAY(),-36) and choose a different fill color.

Easily Track Milestones with WPS Spreadsheet
WPS Spreadsheet fully supports complex conditional formatting and date functions like EDATE and TODAY, allowing you to seamlessly manage employee data and track service milestones dynamically.
- 1. Open Your Spreadsheet: Launch WPS Spreadsheet and open the file containing your employee records.
- 2. Select Start Dates: Highlight the column or range of cells containing the employee start dates.
- 3. Access Conditional Formatting: Go to the Home tab, click on Conditional Formatting, and select New Rule.
- 4. Apply Date Formulas: Select 'Format only cells that contain', set the condition to 'less than or equal to', and input =EDATE(TODAY(), -12) to assign colors based on service years.

Frequently Asked Questions
Why are all my cells turning the same color despite different years of service?
This usually occurs due to rule priority. Go to Conditional Formatting > Manage Rules, and ensure your largest threshold (e.g., 5 years) is evaluated properly by either placing it at the top with 'Stop If True' checked, or by strictly defining 'between' ranges instead of 'less than or equal to'.
Does this formatting automatically update every day?
Yes, because the TODAY() function is volatile, it recalculates every time you open the workbook or change a cell. This ensures the service years and colors are always up to date without manual adjustments.
How do I remove the conditional formatting if I no longer need it?
Select the formatted cells, navigate to the Home tab, click Conditional Formatting, choose Clear Rules, and then select Clear Rules from Selected Cells.




