How to Count Dates Older Than 7, 14, or 30 Days in Excel
Question details
The user wants to count the number of dates in a dataset that are older than a specific number of days or fall within a recent rolling date range using Excel formulas.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking aging items, monitoring overdue tasks, or analyzing data based on rolling timeframes like 7, 14, or 30 days.
- Observed behavior
- The user requires specific COUNTIF and COUNTIFS formulas incorporating the TODAY function to calculate dynamic date thresholds.
Ensure your date column is formatted as valid dates rather than plain text, and verify the exact cell range containing the dates you want to evaluate.
Count dates strictly older than a specific number of days
Use the COUNTIF function combined with the TODAY function to find dates that are older than your target number of days (e.g., 7, 14, or 30 days).
The TODAY() function dynamically retrieves the current system date. By subtracting a set number of days from TODAY(), you can create a rolling threshold to count past dates.
Click on an empty cell where you want the total count result to be displayed.
Type the formula =COUNTIF(H2:H149,"<"&TODAY()-7), replacing 'H2:H149' with the actual range containing your dates.
To check for 14 or 30 days instead of 7, simply change the number 7 in the formula to 14 or 30 (e.g., =COUNTIF(H2:H149,"<"&TODAY()-30)).
Press Enter to execute the formula. Excel will display the total number of dates that meet the criteria.
Count dates within a recent date range
Use the COUNTIFS function to count dates that occurred in the past but are no older than a specific number of days (e.g., within the last 7 days).
Easily Calculate Date Differences with WPS Office
WPS Spreadsheet offers full support for COUNTIF, COUNTIFS, and TODAY functions, allowing you to seamlessly analyze aging reports, track overdue dates, and manage timelines.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the workbook containing the dates you want to evaluate.
- 2. Apply the COUNTIF formula: Select an empty cell and enter the formula =COUNTIF(range,"<"&TODAY()-days).
- 3. Press Enter to execute: Hit Enter to instantly calculate the count of older dates.
- 4. Explore more functions: Navigate to the Formulas tab to easily insert other Date and Time functions for complex calculations.

Frequently Asked Questions
Why is my COUNTIF formula returning 0 for dates?
This usually happens if the dates in your range are formatted as text rather than actual date values. To fix this, select your date range, go to the Home tab, and change the number format to 'Short Date'. Alternatively, use the 'Text to Columns' feature to convert them into real dates.
Can I reference a cell for the number of days instead of typing it in the formula?
Yes. Instead of typing the number directly (e.g., -7), you can reference a cell that contains the number of days. If cell A1 contains the number 7, your formula would look like: =COUNTIF(H2:H149,"<"&TODAY()-A1).
How do I count dates that match exactly today's date?
To count cells that contain today's date only, use the formula without any greater/less than operators: =COUNTIF(H2:H149, TODAY()).
Do these formulas update automatically tomorrow?
Yes, because the TODAY() function is volatile, the formulas will automatically recalculate the date differences based on your computer's current system date whenever the workbook is opened or modified.




