Formula Errors

Sum Values by Criteria and Month with SUMPRODUCT in Excel

Anum MushtaqAnum Mushtaq Nov 27, 2026 870 views

Question details

Sum values from a weekly date table by month using two matching criteria in Excel.

Sum Values by Criteria and Month with SUMPRODUCT in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A source table has two criteria columns and weekly dates across its header row. A results table needs monthly totals for each criteria combination.
Observed behavior
The desired result is a monthly total of values whose row criteria match and whose weekly dates fall within the selected month.
Before you start

Check that the source dates in C4:O4 and the month headings in row 13 are real Excel dates. For the formula below, each month heading must contain the first day of its month.

Solution 1Recommended

Use SUMPRODUCT with two criteria and monthly date boundaries

Use this formula to total weekly values that match both row criteria and fall within each month.

The formula compares the criteria in columns A and B, checks whether each weekly date falls between the month heading and the end of that month, and sums the corresponding values. Adjust the ranges if your table has different dimensions.

1
Arrange the source data

Place the first and second criteria in A5:A10 and B5:B10, weekly dates in C4:O4, and the corresponding numeric values in C5:O10.

2
Set up the results table

Enter the criteria to match in A14 and B14. Enter the first day of the desired month as a real date in C13, and add other month headings across row 13.

3
Enter the formula

In C14, enter =SUMPRODUCT(($A$5:$A$10=$A14)*($B$5:$B$10=$B14)*(EOMONTH(C$13,0)>=$C$4:$O$4)*(C$13<=$C$4:$O$4)*($C$5:$O$10)).

4
Fill the results table

Select C14 and drag its fill handle down and across to calculate totals for the other criteria pairs and month headings.

Use SUMPRODUCT with two criteria and monthly date boundaries
Check date and range alignment: The formula includes dates from the month heading through the last day of that month. The criteria ranges must have the same number of rows as the value range, and the date range must have the same number of columns.
Calculate monthly totals in WPS

Sum weekly data by month in WPS Spreadsheets

Use SUMPRODUCT and EOMONTH in WPS Spreadsheets to calculate monthly totals for two matching criteria, then fill the formula across your results table.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Menu > Open to select your Excel workbook.
  2. 2. Check the table: Confirm that A5:A10 and B5:B10 contain the source criteria, C4:O4 contains real weekly dates, and C5:O10 contains the values.
  3. 3. Enter criteria and a month: Enter the criteria in A14 and B14, and enter the first day of the month as a date in C13.
  4. 4. Calculate and fill: In C14, enter =SUMPRODUCT(($A$5:$A$10=$A14)*($B$5:$B$10=$B14)*(EOMONTH(C$13,0)>=$C$4:$O$4)*(C$13<=$C$4:$O$4)*($C$5:$O$10)). Drag the fill handle down and across to calculate the remaining totals.
  5. 5. Save the workbook: Use Menu > Save As and select an Excel format such as XLSX if you need to share the workbook with Excel users.
Calculate monthly totals from weekly dates using two criteria.Open and edit Microsoft Excel XLSX and XLS files.Copy one formula across multiple months and criteria combinations.Work in a familiar spreadsheet interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why must the month heading be the first day of the month?

The formula uses C13 as the inclusive start date and EOMONTH(C13,0) as the end date. If C13 is a later day, earlier dates in that month are excluded.

How can I tell whether a weekly date is stored as text?

Enter =ISNUMBER(C4) in an empty cell. If it returns FALSE, check the source value and use Data > Text to Columns to convert recognizable text dates.

Does the formula include the last day of the month?

Yes. The comparison EOMONTH(C13,0)>=$C$4:$O$4 includes dates equal to the last day, provided the source dates do not contain later time values.

Why do the source ranges need matching dimensions?

Each criteria range must cover the same rows as the values, and the date header must cover the same columns. If you expand C5:O10, update the corresponding criteria and date ranges as well.