How to Use COUNTIFS with Dates from Excel Pivot Table Data
Question details
The user needs to count records based on two specific date conditions (e.g., before today and after today) referencing data from an Excel Pivot Table or its source data.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Counting specific records based on dynamic date ranges relative to today using multiple conditions.
- Observed behavior
- Needs a working formula to apply multiple date criteria to Pivot Table source data rather than manually counting filtered results.
Ensure that your date columns contain valid Excel date formats rather than text, as COUNTIFS cannot properly evaluate mathematical conditions like 'greater than' on text strings.
Use COUNTIFS on the Pivot Table's Source Data
Referencing the original source table is generally more reliable and flexible than trying to count aggregated pivot table results directly.
Applying functions like COUNTIF or COUNTIFS directly to the displayed results of a Pivot Table can cause errors when the Pivot Table layout changes or refreshes. Instead, applying the formula directly to the underlying source data ensures stability and accuracy.
Locate the worksheet containing the raw data for your Pivot Table. Identify the columns containing the dates you want to evaluate (e.g., Column A and Column B).
Select the cell where you want to display the count result. Type the formula: =COUNTIFS(Source!B:B,">"&TODAY(),Source!A:A,"<"&TODAY())
Modify 'Source!B:B' and 'Source!A:A' in the formula to exactly match the worksheet name and column letters of your actual data.
Press Enter to calculate the count of records that match both dynamic date conditions.

Apply Date Filters Directly in the Pivot Table
If you prefer not to use formulas, you can achieve similar counting results by utilizing Pivot Table Value Filters.
Count Data with Multiple Conditions Easily in WPS Spreadsheet
WPS Spreadsheet offers full support for advanced functions like COUNTIFS and TODAY(), making it simple to analyze complex datasets and Pivot Table source data with complete Excel formula compatibility.
- 1. Open Your Workbook: Launch WPS Spreadsheet and open the file containing your source data and Pivot Table.
- 2. Select Output Cell: Click on the cell where you want to display your counted results.
- 3. Apply the COUNTIFS Formula: Type the formula =COUNTIFS(Source!B:B, ">"&TODAY(), Source!A:A, "<"&TODAY()), modifying the sheet and column names to match your data.
- 4. Get Instant Results: Press Enter to instantly process the data and display the accurate count.

Frequently Asked Questions
Why does my COUNTIFS formula with dates return 0?
This usually happens if the date data is formatted as text rather than a recognized date format. Select your date column, use the 'Text to Columns' feature under the Data tab, or format the cells as Dates to resolve this.
Can I use cell references for the dates instead of the TODAY() function?
Yes, you can replace the TODAY() function with a cell reference. For example, use =COUNTIFS(A:A, ">"&C1) where cell C1 contains your target date.
How do I extract data directly from the Pivot Table instead of the source?
To extract specific data points directly from a Pivot Table, you should use the GETPIVOTDATA function rather than COUNTIFS, as Pivot Table cell coordinates can shift when refreshed.
What is the syntax difference between COUNTIF and COUNTIFS?
COUNTIF evaluates a single condition on a single range (e.g., =COUNTIF(A:A, ">5")). COUNTIFS evaluates multiple conditions across multiple ranges (e.g., =COUNTIFS(A:A, ">5", B:B, "<10")).




