Purpose
Return value
Syntax
=COMPLEX(real_num,i_num,[suffix])
- real_num - The real part of the complex number.
- i_num - The imaginary part of the complex number.
- suffix - [optional] The suffix for the imaginary unit, either "i" or "j".
How to use
The COMPLEX function returns the string representation of a complex number. For example:
=COMPLEX(4,3) // returns "4+3i"
To use the "j" instead of "i":
=COMPLEX(4,3,"j") // returns "4+3j"
To enter the value of a complex number without using the COMPLEX function, write it in a formula like this:
="4+3i"
Explanation
The Excel formula engine handles complex numbers as strings formatted like "x+yi" or "x+yj". For example, when we add two complex numbers together using the IMSUM function, the complex numbers are passed to the function as strings, and the result is a string representing the complex number that is the sum.
=IMSUM("4+3i","2-5i") // returns "6-2i"
We can perform the same operation using COMPLEX to get the strings representing the complex numbers.
=IMSUM(
COMPLEX(4, 3),
COMPLEX(2,-5)
) // returns "6-2i"
In general, The COMPLEX function is useful when you already have a complex number's real and imaginary values and want its string representation.
To read more about complex numbers in Excel, see this article.
Notes:
- If omitted, the suffix defaults to "i".
- The suffix must be lowercase "i" or "j"; other values result in a #VALUE error.
- If real_num or i_num are non-numeric, COMPLEX returns the #VALUE! error