The Google Sheets function COMPLEX is designed to enable users to create complex numbers from real and imaginary coefficients seamlessly. This is particularly useful in applications requiring advanced mathematical calculations, such as engineering or statistical analyses, where complex numbers play a significant role.
Syntax
COMPLEX(real_num, imag_num, [suffix])
- real_num: The real part of the complex number.
- imag_num: The imaginary part of the complex number. This can be written as a numeric value or a string.
- suffix (optional): A text string that specifies a suffix. This can be omitted.
Example #1
=COMPLEX(3, 4)
This function creates a complex number with a real part of 3 and an imaginary part of 4, yielding the result “3+4i”.
Example #2
=COMPLEX(5, -2)
This example generates a complex number with a real part of 5 and a negative imaginary part of -2, resulting in “5-2i”.
Example #3
=COMPLEX(1, 2, "j")
In this instance, the function creates a complex number using “j” as the suffix instead of “i”, resulting in “1+2j”.
Error handling
- Error: VALUE!
Occurs when either the real_num or imag_num is not a valid number. - Error: NAME?
Happens if the function name COMPLEX is misspelled or not recognized in the Google Sheets environment. - Error: Invalid suffix
This error indicates that an unsupported suffix was provided in the function call.