Function Problems

How to Use COUNTIFS with Dates from Excel Pivot Table Data

Phi Hung VoPhi Hung Vo Nov 2, 2026 870 views

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.

How to Use COUNTIFS with Dates from Excel Pivot Table 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.
Before you start

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.

Solution 1Recommended

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.

1
Identify Source Columns

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).

2
Enter the Formula

Select the cell where you want to display the count result. Type the formula: =COUNTIFS(Source!B:B,">"&TODAY(),Source!A:A,"<"&TODAY())

3
Adjust Cell References

Modify 'Source!B:B' and 'Source!A:A' in the formula to exactly match the worksheet name and column letters of your actual data.

4
Calculate Result

Press Enter to calculate the count of records that match both dynamic date conditions.

Use COUNTIFS on the Pivot Table's Source Data
Best Practice: Using the original source data avoids issues with Pivot Table layout shifts, ensuring your formula references remain intact even when the Pivot Table is updated.
Seamless Data Analysis

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. 1. Open Your Workbook: Launch WPS Spreadsheet and open the file containing your source data and Pivot Table.
  2. 2. Select Output Cell: Click on the cell where you want to display your counted results.
  3. 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. 4. Get Instant Results: Press Enter to instantly process the data and display the accurate count.
100% compatible with Microsoft Excel formulas and Pivot TablesLightweight software with fast processing for large datasetsBuilt-in intuitive function builder to simplify complex formulasFree and easy to use for everyday data analysis and reporting
microsoft office alternative - wps office

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")).