How to Use Excel SUMIFS When the Sum Range Contains #N/A
Question details
The user wants to calculate a conditional sum without #N/A values in the sum range causing an error.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Sum values on Sheet2 where the corresponding criteria cells match a value on Sheet1.
- Observed behavior
- SUMIFS can return #N/A when a matching cell in the sum range contains that error.
Check that the sum range and criteria range cover the same number of rows. Identify the cell containing the matching value and the cells containing #N/A.
Exclude #N/A from the SUMIFS sum range
Add the sum range as a second criteria range to exclude #N/A values.
Click the cell where you want the conditional total to appear.
In the formula bar, enter =SUMIFS(Sheet2!$M$8:$M$156,Sheet2!$J$8:$J$156,Sheet1!D33,Sheet2!$M$8:$M$156,"<>#N/A") and press Enter.
Replace the Sheet2 ranges and Sheet1!D33 with your own ranges and matching cell, then verify the total against the matching rows.

Use SUMPRODUCT to treat errors as zero
Use this alternative when you need to ignore errors in the sum range rather than exclude only #N/A.
Calculate error-safe conditional sums in WPS Spreadsheets
Use SUMPRODUCT and IFERROR in WPS Spreadsheets to total matching values while treating errors in the sum range as zero.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Select the result cell: Click the cell where you want to display the conditional total.
- 3. Enter the formula: Enter =SUMPRODUCT(IFERROR(Sheet2!$M$8:$M$156,0),IFERROR(--(Sheet2!$J$8:$J$156=Sheet1!D33),0)) in the formula bar and press Enter.
- 4. Adapt the references: Edit the Sheet2 ranges and Sheet1!D33 to match your workbook, then check the result against the matching rows.

Frequently Asked Questions
Why does SUMIFS return #N/A?
A matching cell in the sum range may contain #N/A. Add the sum range as a criteria range with "<>#N/A", or use SUMPRODUCT with IFERROR to treat errors as zero.
Can I ignore errors other than #N/A?
Yes. Use IFERROR around the sum range in a SUMPRODUCT formula to replace errors such as #N/A and #DIV/0! with zero for the calculation.
Do the SUMIFS ranges need to be the same size?
Yes. In the example, both Sheet2!M8:M156 and Sheet2!J8:J156 cover the same rows. Adjust both ranges together when changing the formula.
What happens if a matching criteria cell contains an error?
The SUMPRODUCT alternative uses IFERROR around the comparison, so an error in a criteria cell is treated as a nonmatch.




