Sum Valid Excel Values and Exclude Errors or Invalid Rows
Question details
Calculate a total and percentage using valid rows while excluding invalid rows and error values.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains status labels and values, and only valid rows should contribute to the total and percentage.
- Observed behavior
- The desired result is a total of valid, error-free values and a percentage based on an appropriate denominator.
Identify the status and value columns, the label that marks a valid row, and the denominator for the percentage. The examples use status cells C2:C25, value cells D2:D25, the label "Valid Content", and a target in F2.
Use SUMPRODUCT to exclude invalid rows and errors
Use this method when either the status column or the value column may contain errors.
Select an empty cell and enter =SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0)). Replace the ranges and label with those in your worksheet.
In another empty cell, enter =IFERROR(SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0))/F2,""). Replace F2 with the cell containing your chosen denominator.
Select the percentage cell and choose Home > Number > Percent Style in Excel.

Use SUMIF when valid rows have a status label
Use this simpler formula when the value range contains no error values.
Sum valid rows and calculate percentages in WPS Spreadsheets
Open your workbook in WPS Spreadsheets, use SUMPRODUCT with IFERROR to exclude invalid or error-containing rows, and divide the valid total by your chosen denominator.
- 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
- 2. Enter the total formula: Select an empty cell and enter =SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0)), adjusting the ranges and label as needed.
- 3. Calculate the percentage: In another cell, enter =IFERROR(SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0))/F2,""); replace F2 with your denominator cell.
- 4. Format and save: Select the percentage cell, choose Percent Style on the Home tab, and save the workbook.

Frequently Asked Questions
Does SUMIF ignore errors in matching value cells?
No. A matching error in the sum range can cause SUMIF to return an error. Use =SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0)) to exclude those errors.
How do I exclude rows with an #N/A status?
Use =SUMPRODUCT(IFERROR((C2:C25="Valid Content")*D2:D25,0)). IFERROR converts errors in the status or value calculation to zero, so those rows do not contribute to the total.
What should I use as the percentage denominator?
Choose a denominator that matches your goal, such as a target value in F2. Divide the valid total by that cell and apply Percent Style; use a nonzero numeric value.
Why does the percentage formula return a blank?
In =IFERROR(E2/F2,""), a blank appears when the division produces an error, such as when F2 is zero. Check the denominator cell and the total in E2.




