How to Highlight More Than Two Occurrences in 30 Days with Excel Conditional Formatting
Question details
The user needs a conditional formatting rule to count and highlight instances where the same person has more than two recorded events (such as falls) within a rolling 30-day period.

- Product
- Excel / WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- Tracking recurring events for specific individuals over a rolling 30-day window to visually flag cells when the frequency threshold is exceeded.
- Observed behavior
- The user wants to format a specific cell (e.g., in column H) when a custom formula detects that a person's name appears more than twice in the past 30 days based on their corresponding event dates.
Ensure your dataset is organized with clear, consistent columns for the person's name (e.g., Column A) and the exact date of the event formatted as valid dates (e.g., Column C).
Apply a Custom COUNTIFS Formula in Conditional Formatting
Use a formula-based conditional formatting rule to dynamically count occurrences within a rolling 30-day window for each person.
By utilizing the COUNTIFS function, you can evaluate multiple criteria at once. In this scenario, the formula checks if the name matches the current row and if the date falls within the 30 days prior to the current row's date.
Highlight the cells you want to format. For example, select cells H2 through H100.
Go to the Home tab on the ribbon, click 'Conditional Formatting', and select 'New Rule'.
Choose 'Use a formula to determine which cells to format' and enter: =COUNTIFS($A$2:$A$100,$A2,$C$2:$C$100,">="&$C2-30,$C$2:$C$100,"<="&$C2)>2
Click the 'Format' button, navigate to the Fill tab, select a highlight color (such as red or yellow), and click 'OK' to apply the rule.

Manage Multiple Conditional Formatting Rules and Priorities
Set up multiple color-coded rules and adjust their precedence to handle overlapping criteria (e.g., highlighting different thresholds with different colors).
Highlight Data Dynamically in WPS Spreadsheets
WPS Spreadsheets provides robust conditional formatting capabilities, allowing you to seamlessly apply complex formulas like COUNTIFS to analyze and highlight rolling date ranges.
- 1. Open your dataset: Launch WPS Spreadsheets and open the workbook containing your event tracking data.
- 2. Access conditional formatting: Highlight the target column, navigate to the Home tab, and click on 'Conditional Formatting' > 'New Rule'.
- 3. Apply the COUNTIFS rule: Select 'Use a formula', paste your rolling 30-day COUNTIFS formula, customize the fill color, and click OK to highlight your data instantly.

Frequently Asked Questions
Why is my conditional formatting formula highlighting the wrong cells?
This usually happens due to incorrect cell references. Ensure you are using absolute references for your data arrays (e.g., $A$2:$A$100) and mixed references for the criteria checking the current row (e.g., $A2), so the formula correctly shifts evaluation row by row.
Can I change the rolling period to 90 days instead of 30?
Yes. You can easily modify the formula to accommodate any time frame. Simply change the '-30' in the formula string ">="&$C2-30 to '-90' to evaluate occurrences over a 90-day rolling window.
Does the COUNTIFS formula work properly if there are blank cells in the date column?
Blank cells might be evaluated as a zero value (representing an old date), which can throw off your count. To prevent false highlights, add an additional condition to your COUNTIFS formula, such as $C$2:$C$100,"<>", to ensure blank cells are ignored.




