Engineering functions

COMPLEX

Known larger differences on 50 of 10,699 recorded answers

Of 10,699 recorded answers (10,694 in the answer bank and 5 workbook cells), 50 do not match: 40 differ in kind or value, 10 are refused. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicCOMPLEX
BulgarianCOMPLEX
CzechCOMPLEX
DanishKOMPLEKST
GermanCOMPLEX
GreekCOMPLEX
English (Australia)COMPLEX
English (United Kingdom)COMPLEX
English (United States)COMPLEX
SpanishCOMPLEJO
EstonianCOMPLEX
FinnishKOMPLEKSI
FrenchCOMPLEXE
HebrewCOMPLEX
CroatianCOMPLEX
HungarianKOMPLEX
IndonesianCOMPLEX
ItalianCOMPLEX
Japanese複雑
KoreanCOMPLEX
LithuanianCOMPLEX
LatvianCOMPLEX
NorwegianCOMPLEX
DutchCOMPLEX
PolishLICZBA.ZESP
Portuguese (Brazil)COMPLEXO
Portuguese (Portugal)COMPLEXO
RomanianCOMPLEX
RussianКОМПЛЕКСН
SlovakCOMPLEX
SlovenianCOMPLEX
Serbian (Latin)COMPLEX
SwedishKOMPLEX
ThaiCOMPLEX
TurkishKARMAŞIK
UkrainianCOMPLEX
VietnameseCOMPLEX
Chinese (Simplified)COMPLEX
Chinese (Hong Kong)COMPLEX
Chinese (Traditional)COMPLEX

Names from Microsoft's support site.

What it does

COMPLEX(real_num, i_num, [suffix])

COMPLEX(real_num, i_num, [suffix]) constructs Excel’s text representation of a complex number from its two numeric coefficients. The optional imaginary suffix defaults to "i"; "j" is also supported.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=COMPLEX(2,-3) returns "2-3i". =COMPLEX(0,1,"j") returns "j", since the real zero and imaginary coefficient one are suppressed.

Quirks

Only lowercase i and j are documented suffixes; another suffix gives #VALUE!. A nonnumeric coefficient also gives #VALUE!. The result is text, not a new numeric cell type. The current implementation also admits an empty suffix as the default i; that is an implementation detail beyond the documented two spellings.

How to implement

Coerce the two coefficients, validate the suffix and normalise zeros. Format each nonzero coefficient under the complex decimal-format rules. If both are zero, produce text zero. Join the real part and signed imaginary part without spaces, omitting the imaginary coefficient when its magnitude is one. For 2,-3, emit the real two, then the minus sign, then 3i. Do not use an arbitrary language debug representation: exponent spelling, precision and sign suppression are reader-visible.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

COMPLEX · 16 lines · calc-func/src/catalogue/engineering.rs on GitHub
30 complex "COMPLEX" (2, 3) [V "real_num", V "i_num", V "suffix"] |s, a, sv| {
    let re = coefficient(s, a, 0)?;
    let im = coefficient(s, a, 1)?;
    let suffix = match a.get(2).map(CalcValue::core_ref) {
        None | Some(CoreRef::Missing | CoreRef::Empty) => 'i',
        Some(CoreRef::Error(code)) => return fail(code),
        Some(CoreRef::Text(_)) => match text(s, a, 2)?.trim() {
            "" | "i" => 'i',
            "j" => 'j',
            _ => return fail(WorksheetErrorCode::Value),
        },
        Some(_) => return fail(WorksheetErrorCode::Value),
    };
    let text = format_complex_text(ParsedComplex::new(re, im, None), suffix).map_err(Exit::Error)?;
    Ok(text_value(&text))
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20430Windows, 64-bit, CPU not recorded10,694

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

10,694 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

IMREAL and IMAGINARY recover the coefficients; IMSUM and IMPRODUCT perform complex arithmetic.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents