COMPLEX Function (LibreOffice Calc)
The COMPLEX function converts real and imaginary numeric components into a complex number formatted as text. It is used in engineering, signal processing, AC circuit analysis, and any workflow involving complex arithmetic.
Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked
Availability and version history
- Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
- Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
- Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
- Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.
What the COMPLEX Function Does
- Combines real and imaginary parts into a complex number
- Supports
"i"or"j"notation - Returns a text string, not a numeric type
- Works seamlessly with other IM* complex functions
Syntax
COMPLEX(real; imaginary; [suffix])
Arguments
-
real:
The real component of the complex number. -
imaginary:
The imaginary component. -
suffix (optional):
"i"(default) or"j"— engineering notation.
Basic Examples
Default imaginary unit (i)
=COMPLEX(3; 4)
→ "3+4i"
Using engineering notation (j)
=COMPLEX(5; -2; "j")
→ "5-2j"
Zero imaginary part
=COMPLEX(7; 0)
→ "7+0i"
Zero real part
=COMPLEX(0; 9)
→ "0+9i"
Advanced Examples
Build a complex impedance
=COMPLEX(10; 5)
→ "10+5i"
Combine with IMSUM
=IMSUM(COMPLEX(3;4); COMPLEX(1;-2))
→ "4+2i"
Use with IMABS to compute magnitude
=IMABS(COMPLEX(A1; B1))
Use with IMSQRT for square roots of negative numbers
=IMSQRT(COMPLEX(-4; 0))
Generate a phasor from magnitude and angle
=COMPLEX(R*COSH(θ); R*SINH(θ))
Build a dynamic complex expression
=COMPLEX(A1; A2 * PI())
Edge Cases and Behavior Details
COMPLEX returns a text string, not a numeric complex type
All IM* functions accept this string format.
Behavior details
- Imaginary part sign is handled automatically
"i"or"j"must be lowercase- Non-numeric inputs → Err:502
- Suffix must be
"i"or"j"only - COMPLEX does not validate magnitude or angle
COMPLEX of an error → error propagates
Common Errors and Fixes
Err:502 — Invalid argument
Cause:
- Non-numeric real or imaginary part
- Invalid suffix (anything other than “i” or “j”)
Fix:
- Validate numeric inputs
- Use only “i” or “j”
Unexpected formatting
Cause:
- Imaginary part negative → auto‑formatted as subtraction
Fix:
- This is expected behavior
Best Practices
- Use COMPLEX to construct valid inputs for IM* functions
- Use
"j"for electrical engineering workflows - Keep real and imaginary parts in separate cells for clarity
- Use IMABS, IMARG, IMSUM, IMDIV, etc., for further operations
- Avoid mixing COMPLEX strings with numeric arithmetic
Related Patterns and Alternatives
- IMREAL / IMAG — extract components
- IMABS — magnitude
- IMARG — phase angle
- IMCONJUGATE — conjugate
- IMSUM / IMPRODUCT / IMDIV — arithmetic
- IMSQRT — square root of complex numbers
By mastering COMPLEX, you can build powerful engineering, signal‑processing, and mathematical models in LibreOffice Calc.
Reproducible example (tested in LibreOffice Calc)
This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.
=COMPLEX(3;4)
Expected result: 3+4i.
Combine real and imaginary components into a complex number.
If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.