IMAGINARY
Returns the imaginary coefficient of a complex number.
Accepts complex text (for example a+bi) or numeric values.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=IMAGINARY(inumber)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
inumber | any | Required | — |
How it works
For z = a + bi, the result is b, the signed imaginary coefficient. A purely real input has imaginary coefficient zero.
Remarks
- Inputs are coerced to complex-number text before parsing.
- Purely real values return
0.
Error cases
- Invalid complex text returns
#NUM!.
Examples
Read the imaginary coefficient of 3 + 4i.
Formula =IMAGINARY("3+4i")
Expected result 4
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Extract the signed coefficient of j from 3 − 4j.
Formula =IMAGINARY("3-4j")
Expected result -4
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A purely real input has imaginary coefficient zero.
Formula =IMAGINARY("1")
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The text “invalid” has no complex value from which to extract the imaginary coefficient.
Formula =IMAGINARY("invalid")
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Imaginary part with j suffix
Formula =IMAGINARY("-2j")
Expected result -2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What does IMAGINARY return for a real-only input?
It returns 0 because there is no imaginary component.