Divide the Sum of One Excel Range by Another
Question details
Calculate the ratio of the sum of AJY9:AKD9 to the sum of AJY17:AKD17, with optional error handling.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants to divide the total of one row range by the total of another row range.
- Observed behavior
- The desired result is a ratio calculated from the two range totals, with an option to return zero if an error occurs.
Check that AJY9:AKD9 and AJY17:AKD17 contain the values you want to total. Choose an empty cell outside those ranges for the formula.
Divide the two range totals with SUM
Use this formula to calculate the ratio and show any calculation errors.
Click an empty cell outside AJY9:AKD9 and AJY17:AKD17.
Type =SUM(AJY9:AKD9)/SUM(AJY17:AKD17) in the cell or formula bar, then press Enter.

Return zero when the ratio formula produces an error
Wrap the division in IFERROR when you prefer zero instead of an error message.
Divide Range Totals in WPS Spreadsheets
Use SUM to divide the totals of two ranges in WPS Spreadsheets, and add IFERROR if you want errors to return zero.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your workbook.
- 2. Select a result cell: Click an empty cell outside the two source ranges.
- 3. Enter the ratio formula: Type =SUM(AJY9:AKD9)/SUM(AJY17:AKD17) and press Enter.
- 4. Add error handling if needed: To return zero for errors, replace the formula with =IFERROR(SUM(AJY9:AKD9)/SUM(AJY17:AKD17),0) and press Enter.

Frequently Asked Questions
Why does the formula show #DIV/0!?
The sum of AJY17:AKD17 is zero, so Excel cannot divide by it. Check the values in that range or use IFERROR to return zero instead.
How can I show the ratio as a percentage?
Select the result cell and choose Home > Percent Style. The underlying ratio remains unchanged.
Does IFERROR hide errors other than division by zero?
Yes. IFERROR returns the specified fallback for any error in the formula, including errors originating in the source ranges.
Can I use the same formula in WPS Spreadsheets?
Yes. Enter =SUM(AJY9:AKD9)/SUM(AJY17:AKD17) in an empty cell in WPS Spreadsheets, or wrap it in IFERROR to return a fallback value.




