COMPLEX function
Builds a complex number as text, such as "3+4i", from a real part and an imaginary part. Lets you choose i or j as the suffix.
Available in Excel 2007 and later (Excel 2003 needed the Analysis ToolPak add-in), Microsoft 365, Excel for the web, Excel for Mac
Excel 2007 and laterWorks in Google Sheets
Syntax
COMPLEX(real_num, i_num, [suffix])| Argument | What it means | |
|---|---|---|
real_num | Required | The real part of the complex number. |
i_num | Required | The imaginary part (the coefficient of i). |
suffix | Optional | "i" (default) or "j", in lower case. Electrical engineers often use j because i means current. |
Returns: Text in the form x+yi or x+yj that all the IM functions understand.
How COMPLEX works
Excel has no special data type for complex numbers. Instead it stores them as text such as 3+4i, and a family of IM functions (IMSUM, IMPRODUCT, IMABS and so on) reads and writes that text. COMPLEX is the safe way to create the text from two ordinary numbers, so you do not have to worry about signs, missing parts or formatting.
COMPLEX tidies the output the way Excel likes it: a zero imaginary part leaves just the real number (3), a zero real part leaves just the imaginary part (4i), and a coefficient of 1 or -1 is written as i or -i. Numbers are written with up to 15 significant digits.
The suffix must be exactly "i" or "j" in lower case; capital letters return #VALUE!. Keep one suffix throughout a calculation — IM functions refuse to mix i and j in the same formula.
Examples
1Combine real and imaginary parts
| A | B | C | |
|---|---|---|---|
| 1 | Real | Imaginary | |
| 2 | 3 | 4 | 3+4i |
Result: 3+4i
The two numbers become the text 3+4i, ready for any IM function. =IMABS(C2) would then return 5.
2Impedance with the j suffix
| A | B | C | |
|---|---|---|---|
| 1 | Resistance (Ω) | Reactance (Ω) | |
| 2 | 50 | -25.5 | 50-25.5j |
Result: 50-25.5j
A 50 Ω resistor in series with a capacitor of -25.5 Ω reactance has impedance 50-25.5j. Note how Excel writes the minus sign for you.
3Pure imaginary unit
| A | B | C | |
|---|---|---|---|
| 1 | Real | Imaginary | |
| 2 | 0 | -1 | -i |
Result: -i
With a real part of 0 and an imaginary part of -1, Excel simply writes -i.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | real_num or i_num is non-numeric text, or suffix is anything other than "i", "j" or empty (for example "I" or "J"). | Use lower-case i or j and numeric parts. |
Tips
- The result is text, so
=A1+B1on two complex cells gives#VALUE!. Use IMSUM, IMSUB, IMPRODUCT and IMDIV for arithmetic. - Use IMREAL and IMAGINARY to split a complex number back into its parts.
- You can type complex text directly, like
"3+4i", but COMPLEX avoids typos such as3 + 4iwith spaces, which the IM functions reject.
Google Sheets
COMPLEX also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
COMPLEX in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | KOMPLEKS |
| Finnish | KOMPLEKSI |
| French | COMPLEXE |
| German | KOMPLEXE |
| Hungarian | KOMPLEX |
| Italian | COMPLESSO |
| Norwegian (Bokmål) | KOMPLEKS |
| Polish | LICZBA.ZESP |
| Portuguese (Brazil) | COMPLEXO |
| Portuguese (Portugal) | COMPLEXO |
| Russian | КОМПЛЕКСН |
| Spanish | COMPLEJO |
| Swedish | KOMPLEX |
| Turkish | KARMAŞIK |