How to Average Excel Cells Containing IMSUB Complex Numbers
Question details
The user needs to calculate the average of complex numbers generated by the IMSUB function without triggering an error.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Averaging mathematical or engineering data that involves complex numbers stored in multiple cells.
- Observed behavior
- Using the standard AVERAGE function on IMSUB results returns a #DIV/0! error because the complex numbers are stored as text strings rather than standard numeric values.
Identify the exact range of cells containing your IMSUB complex numbers and count the total number of values you need to average. Ensure none of the referenced cells contain standard error values (such as #VALUE!) that might disrupt the calculation.
Calculate the Average Using IMDIV and IMSUM Functions
Since complex numbers are formatted as text strings, you must bypass the AVERAGE function and manually sum and divide the values using specific complex-number functions.
The standard AVERAGE function ignores text strings. Because the IMSUB function outputs complex numbers (e.g., '3+4i') as text, AVERAGE sees zero numeric values and attempts to divide by zero, resulting in a #DIV/0! error.
To solve this, use the IMSUM function to add the complex numbers together, and then use the IMDIV function to divide that sum by the total count of values.
Click on the cell where you want the calculated average of your complex numbers to appear.
Type =IMSUM(A1, B2, C3) to add the targeted complex number cells together. Replace A1, B2, C3 with the actual cell references containing your IMSUB results.
Modify the formula to divide the sum by the total number of referenced cells. For 3 cells, type =IMDIV(IMSUM(A1, B2, C3), 3) and press Enter to get the average.

Master Complex Formulas with WPS Office
WPS Spreadsheet offers full support for advanced engineering formulas, including complex number calculations like IMSUB, IMSUM, and IMDIV. It is a lightweight, highly compatible alternative for handling intricate mathematical datasets.
- 1. Open your workbook: Launch WPS Spreadsheet and open the .xlsx file containing your complex number data.
- 2. Apply complex functions: Use the =IMDIV(IMSUM(...)) structure exactly as you would in Microsoft Excel to calculate your averages.
- 3. Save and share: Save your document in the standard .xlsx format to ensure perfect compatibility when sharing with other users.

Frequently Asked Questions
Why does the AVERAGE function return #DIV/0! for IMSUB results?
The IMSUB function generates complex numbers in the format 'x+yi', which are recognized and stored as text strings. The standard AVERAGE function ignores text, so it counts zero numeric items. Dividing by zero then triggers the #DIV/0! error.
Can I use AVERAGEIF to calculate complex numbers in Excel?
No. The AVERAGEIF function relies on the same underlying arithmetic logic as the standard AVERAGE function. It expects standard numeric inputs and will fail when attempting to process complex numbers stored as text.
How do I average a large contiguous range of complex numbers?
You can use a range reference within the IMSUM function. For example, to average a contiguous block of cells from A1 to A10, you would use the formula =IMDIV(IMSUM(A1:A10), 10).
Are IMDIV and IMSUM functions available in WPS Office?
Yes, WPS Spreadsheet natively supports standard engineering functions including IMDIV, IMSUM, and IMSUB, maintaining complete formula compatibility with your existing Excel spreadsheets.




