Excel Formula to Divide a Sum by the Count of Positive Values
Question details
The user needs a formula that divides the sum of a range by the number of cells containing values greater than zero.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Calculate a range’s total divided by its count of positive values.
- Observed behavior
- The desired result uses all numeric values in the sum but counts only values greater than zero in the divisor.
Identify the range to calculate and check that it contains at least one positive number. Note that negative numbers are included in the sum, even though they are not included in the positive-value count.
Use SUM and COUNTIF to Calculate the Result
Use this formula to divide a range’s total by the count of values greater than zero.
In Excel, click an empty cell where you want the result to appear.
Type =SUM(A1:A10)/COUNTIF(A1:A10,">0") and replace both instances of A1:A10 with your range.
Press Enter. Excel divides the sum of the range by the number of cells whose values are greater than zero.

Divide a Sum by a Positive-Value Count in WPS Spreadsheets
Use the same SUM and COUNTIF formula in WPS Spreadsheets to calculate the result in an existing workbook or a new sheet.
- 1. Open a spreadsheet: Open WPS Spreadsheets and use Open to select your workbook, or create a new spreadsheet.
- 2. Select a cell: Click an empty cell where you want to display the result.
- 3. Enter the formula: Type =SUM(A1:A10)/COUNTIF(A1:A10,">0"), replacing both range references with your data range.
- 4. Calculate and save: Press Enter to calculate the result, then use File > Save to save the workbook.

Frequently Asked Questions
Does this formula include negative numbers in the sum?
Yes. SUM(A1:A10) includes negative numbers, but COUNTIF(A1:A10,">0") counts only values greater than zero.
How can I avoid a #DIV/0! error when there are no positive values?
Use =IF(COUNTIF(A1:A10,">0")=0,"",SUM(A1:A10)/COUNTIF(A1:A10,">0")) to display a blank when the positive-value count is zero.
How do I sum and count only positive values?
Use =SUMIF(A1:A10,">0")/COUNTIF(A1:A10,">0"). This returns the average of the positive values and excludes negative values from both parts of the calculation.
What if Excel does not accept commas in the formula?
Your regional settings may require semicolons as argument separators. Try =SUM(A1:A10)/COUNTIF(A1:A10;">0") instead.




