Formula Errors

Excel Formula to Divide a Sum by the Count of Positive Values

Nimra MalikNimra Malik Nov 22, 2026 868 views

Question details

The user needs a formula that divides the sum of a range by the number of cells containing values greater than zero.

Divide a Sum by the Count of Positive Values in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select a result cell

In Excel, click an empty cell where you want the result to appear.

2
Enter the formula

Type =SUM(A1:A10)/COUNTIF(A1:A10,">0") and replace both instances of A1:A10 with your range.

3
Calculate the result

Press Enter. Excel divides the sum of the range by the number of cells whose values are greater than zero.

Use SUM and COUNTIF to Calculate the Result
Avoid a division error: If the range contains no positive values, the formula returns #DIV/0!. To display a blank instead, use =IF(COUNTIF(A1:A10,">0")=0,"",SUM(A1:A10)/COUNTIF(A1:A10,">0")).
Calculate in WPS Spreadsheets

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. 1. Open a spreadsheet: Open WPS Spreadsheets and use Open to select your workbook, or create a new spreadsheet.
  2. 2. Select a cell: Click an empty cell where you want to display the result.
  3. 3. Enter the formula: Type =SUM(A1:A10)/COUNTIF(A1:A10,">0"), replacing both range references with your data range.
  4. 4. Calculate and save: Press Enter to calculate the result, then use File > Save to save the workbook.
Count positive values with COUNTIF while summing the full rangeOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and cell references
microsoft office alternative - wps office

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.