Fix Excel SUMIF Returning Zero When Summing Expenses by Month, Category, and Subcategory
Question details
The user needs to calculate total expenses based on specific combinations of month, major category, and subcategory created with a dynamic array, but the summation formula is failing.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Attempting to total amounts corresponding to unique combinations of month, major category, and subcategory created via a dynamic array formula.
- Observed behavior
- The SUMIF function returns zeros instead of the actual total amounts for the corresponding categories.
Before troubleshooting your SUMIF formula, verify that your date columns are formatted consistently (use =ISNUMBER() to check if they are recognized as real dates or text) and ensure there are no trailing spaces in your category text.
Correct the SUMIF Syntax and Array Ranges
Fix the SUMIF formula by ensuring the criteria array matches the concatenated range and the sum range is placed in the correct argument position.
When using SUMIF with dynamic arrays (like H2#), the syntax must strictly follow SUMIF(range, criteria, [sum_range]). Often, zeros are returned if the sum range and criteria range are swapped, or if their row limits do not match exactly.
Ensure all your data ranges share the exact same row limits. For example, if your sum range is C2:C322, your criteria ranges must also start at row 2 and end at row 322.
Combine your source columns (Month, Category, Subcategory) inside the formula to match your dynamic array criteria format. Example: LEFT(A2:A322,2)&" "&E2:E322&" "&F2:F322.
Enter the formula placing the concatenated source array first, your dynamic criteria (H2#) second, and the amount column third. Example: =SUMIF(LEFT(A2:A322,2)&" "&E2:E322&" "&F2:F322, H2#, C2:C322).

Use a PivotTable for Complex Summaries
A PivotTable is often more straightforward and less error-prone than complex dynamic array formulas for grouping by multiple categories.
Master Multi-Condition Summation in WPS Office
WPS Spreadsheet offers powerful functions like SUMIFS, dynamic arrays, and intuitive PivotTables to help you quickly calculate complex expenses without formula errors.
- 1. Open your data in WPS Spreadsheet: Launch WPS Office and open your expense tracker workbook.
- 2. Use the SUMIFS function: Select the cell for your total and type =SUMIFS(. This function is better suited for multiple conditions than SUMIF.
- 3. Define the sum range: Select the column containing your expense amounts as the first argument.
- 4. Add multiple criteria: Select your first criteria range (e.g., Month column) and the criteria cell, then repeat for Category and Subcategory. Press Enter to calculate.

Frequently Asked Questions
Why does my SUMIFS formula return a zero when summing by month?
This usually happens if the data formats do not match. If your source column contains real date values (serial numbers) but your criteria uses text (like 'Jan'), the formula won't find a match. Use the MONTH() function or ensure formats align perfectly.
What is the difference between SUMIF and SUMIFS?
SUMIF is designed for a single condition (e.g., sum amounts if Category is 'Food'). SUMIFS allows you to check multiple conditions simultaneously across different columns (e.g., Month is 'Jan' AND Category is 'Food').
How do I remove trailing spaces that cause formula mismatches?
Extra spaces prevent exact text matches in formulas. You can wrap your text ranges in the TRIM() function or use the Find and Replace tool (Ctrl+H) to remove extra spaces from your source data, ensuring your categories match the criteria perfectly.




