How to Apply Conditional Formatting for Repeated Dates Across Multiple Years
Question details
The user wants to highlight specific days and months where social media posts occurred across multiple distinct years, using color codes based on the number of years.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Tracking social media post occurrences over several years and dynamically highlighting a calendar or summary grid based on year frequency.
- Observed behavior
- Needs yellow cell formatting for posts occurring in at least two distinct years, green for at least three distinct years, and no formatting for one or zero years.
Ensure your raw data includes clearly defined columns for the day, month, and year of the social media posts so that the formulas can reference them accurately.
Use Dynamic Array Formulas (FILTER and UNIQUE)
Best for modern spreadsheet versions that support dynamic arrays to directly count distinct years matching a specific month and day.
By combining the FILTER and UNIQUE functions, you can extract only the distinct years for a given date criteria and then count them. This result directly drives your conditional formatting rules.
Highlight the summary table or calendar grid where you want the colors to appear.
Go to Home > Conditional Formatting > New Rule. Select 'Use a formula to determine which cells to format'. Enter your dynamic formula, such as `=COUNTA(UNIQUE(FILTER(Sheet2!$F$2:$F$100,(Sheet2!$D$2:$D$100=B$1)*(Sheet2!$E$2:$E$100=$A2))))>=2`, and set the cell fill color to Yellow.
Repeat the previous step to add a second rule. Change the condition at the end of the formula to `>=3` and set the cell fill color to Green.
Go to Conditional Formatting > Manage Rules. Ensure the Green rule (>=3) is at the very top of the list so it evaluates first. Check the 'Stop If True' box next to it if necessary.

Use TEXTJOIN and Character Counting (Alternative)
A reliable workaround for older versions that do not support the FILTER and UNIQUE dynamic array functions.
Easily Highlight Data Trends with WPS Spreadsheet
WPS Office provides robust data analysis tools, supporting advanced array formulas and flexible conditional formatting to help you visualize multi-year trends effortlessly.
- 1. Open your data file: Launch WPS Spreadsheet and open the workbook containing your social media dates.
- 2. Highlight target cells: Select the range of cells in your summary calendar that you want to format.
- 3. Add Conditional Formatting: Navigate to the Home tab, click 'Conditional Formatting', and select 'New Rule'.
- 4. Input the formula: Choose the formula option, paste your distinct year counting formula, and easily manage rule priorities in the Rules Manager.

Frequently Asked Questions
Why is my green conditional formatting rule not applying?
If your yellow rule (>=2) is above your green rule (>=3) in the Conditional Formatting Rules Manager, the yellow rule will trigger first and stop the formatting process. Move the green rule to the top of the list so higher counts are prioritized.
Can I count distinct values without the UNIQUE function?
Yes. If your software lacks the UNIQUE function, you can insert a PivotTable to summarize distinct occurrences first, or use a helper cell with TEXTJOIN to concatenate values and then count the delimiters mathematically.
How do I apply a formula-based formatting rule to an entire calendar grid?
Select your entire grid before creating the rule, and ensure your formula uses correct mixed references (like `$A2` for locking the row and `B$1` for locking the column). This allows the single formula to adjust dynamically for each individual cell in the selection.




