In some branches of engineering, it’s inevitable that you’re going to end up working with complex numbers. Fortunately, though, you don’t have to run to another piece of software to perform calculations with these numbers. There is built-in capability to work directly with complex numbers in Excel.
How to Enable Complex Number Calculations in Excel
Microsoft does not automatically expose the complex number functions in default Excel installations.
Why? I don’t know. Maybe to reduce the “complex”-ity?
Sorry – couldn’t help it. J
To gain access to them, first enable the Analysis Toolpak Add-In.
- Navigate to the Developer Tab
- Click “Excel Add-Ins”
- Select “Analysis Toolpak”
Once turned on, these functions reside in the “Engineering” category of Excel functions.
Complex Number Functions in Excel
The first, and most fundamental, complex number function in Excel converts two components (one real and one imaginary) into a single complex number represented as a+bi. The function is “COMPLEX” and its syntax is as follows:
COMPLEX(real_num, i_num, [suffix])
real_num is the real part of the complex number
i_num is the imaginary part of the complex number
[suffix] is the letter appended to the imaginary component of the complex number. You can use this optional argument to change the suffix from “i” to “j” if you wish. However, for most of us this can be omitted and the suffix will default to “i”.
As an example, entering the following equation in Excel:
yields this result:
Conversely, the real and imaginary components of a complex number can be extracted using the IMREAL and IMAGINARY functions, respectively:
Want to learn even more about advanced Excel techniques? Watch my free training just for engineers. In the three-part video series I'll show you how to solve complex engineering challenges in Excel. Click here to get started.
If this is where Excel’s complex number capability stopped, it would be a huge disappointment. But Microsoft includes many more useful functions for complex number calculations:
- IMABS: Returns the absolute value of a complex number. This is equivalent to the magnitude of the vector.
- IMSUM, IMSUB, IMPRODUCT, IMDIV: Return the results of complex number addition, subtraction, multiplication, and division
- IMSIN, IMCOS, IMTAN, etc.: Return the sine, cosine, tangent, etc. of a complex number.
- IMEXP, IMLN, IMLOG10, IMLOG2: Return the exponential, natural log, log (base 10) and log (base 2) of a complex number
These functions enable many different engineering calculations in Excel, such as analyzing current in an RLC circuit or describing the motion of a damped harmonic oscillator.
Example: Complex Numbers in Excel
Let’s take a look at one of the calculations that Excel’s complex number functions enable: an RLC circuit.
Suppose we have a circuit with a voltage of 12 volts and an impedance (Z) of 5+10j ohms. What is the current in the circuit?
From circuits, we remember that:
As you’ve seen, we can use Excel to handle the complex number calculations.
First, I enter the input values for voltage and impedance.
Since the impedance is a complex number, I use the COMPLEX function in Excel.
In this case, I’ve used the suffix “j” to avoid confusion between the imaginary number “i” and the current “I”.
Next, to calculate the current, I divide the voltage by the complex impedance using the function IMDIV.
Finally, we have our result:
Complex numbers will always be…umm…complex, I guess. But they don’t have to be difficult. J We can handle calculations involving complex numbers in Excel with a few simple functions.