Add a Month Filter to an Excel SUMPRODUCT Count
Question details
Count records that match several criteria and a specified month in a date column.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A SUMPRODUCT formula checks three criteria on the AP sheet and needs an additional date filter.
- Observed behavior
- The desired count includes only records matching the existing criteria and the selected month.
Check that AP!B8:B2999 contains valid Excel dates and that D32 contains a date in the month you want to count. Make sure all ranges in the SUMPRODUCT formula cover the same rows.
Count a Specific Month and Year Using Date Boundaries
Use this method to count records in the month and year specified by D32.
The date conditions include the first day of the selected month and exclude the first day of the next month. This also includes dates with time values.
Click the cell containing your existing SUMPRODUCT count.
Enter =SUMPRODUCT(--(AP!$Y$8:$Y$2999=$C$31),--(AP!$AQ$8:$AQ$2999=$B36),--(AP!$AT$8:$AT$2999=C$3),--(AP!$B$8:$B$2999>=DATE(YEAR(D$32),MONTH(D$32),1)),--(AP!$B$8:$B$2999<EDATE(DATE(YEAR(D$32),MONTH(D$32),1),1))) and press Enter.
Change the date in D32 or inspect matching rows on the AP sheet to verify the count.

Count the Same Calendar Month Across All Years
Use a MONTH condition when the year should not affect the count.
Filter a SUMPRODUCT Count by Month in WPS Spreadsheets
Open your workbook in WPS Spreadsheets and use SUMPRODUCT with date boundaries to count records for a selected month and year.
- 1. Open the workbook: In WPS Spreadsheets, open the Excel workbook containing the AP sheet.
- 2. Set the month: Enter a valid date from the desired month in cell D32.
- 3. Enter the count formula: Select the result cell and enter =SUMPRODUCT(--(AP!$Y$8:$Y$2999=$C$31),--(AP!$AQ$8:$AQ$2999=$B36),--(AP!$AT$8:$AT$2999=C$3),--(AP!$B$8:$B$2999>=DATE(YEAR(D$32),MONTH(D$32),1)),--(AP!$B$8:$B$2999<EDATE(DATE(YEAR(D$32),MONTH(D$32),1),1))).
- 4. Calculate and save: Press Enter to calculate the count, then use File > Save to save the workbook.

Frequently Asked Questions
Why does the MONTH formula count records from other years?
MONTH compares only the month number. To restrict the count to the year in D32 as well, use the date-boundary formula or add a YEAR condition.
Can D32 contain any day in the month I want to count?
Yes. Enter a valid Excel date in D32; DATE(YEAR(D32),MONTH(D32),1) calculates the first day of that month.
Why does my SUMPRODUCT formula return an error?
Check that the ranges cover the same number of rows and that D32 contains a valid date. If you use MONTH on the date column, check AP!B8:B2999 for invalid date values too.
Will the date-boundary formula include dates with times?
Yes. It includes values from the first day of the selected month up to, but not including, the first day of the following month.




