The Excel IMAGINARY Function

Complex Numbers

Within the world of complex numbers, the 'imaginary' value, i is used to represent the square root of -1.

A Complex Number is composed of a real number combined with an imaginary number.

E.g. The complex number, z, is written as

z   =   5 + 2i
Related Function:
IMREAL Function

Function Description

The Excel IMAGINARY function returns the imaginary coefficient of a supplied complex number.

I.e. for the complex number a + bi, the Excel Imaginary function returns the value b.

The syntax of the function is:

IMAGINARY( inumber )

where the inumber argument is a complex number.

Complex Numbers in Excel

Note that complex numbers are simply stored as text in Excel. When a text string in the format "a+bi" or "a+bj" is supplied to one of Excel's built-in complex number functions, this is interpreted as a complex number.

Also the complex number functions can accept a simple numeric value, as this is equivalent to a complex number whose imaginary coefficient is equal to 0.

Therefore, the inumber argument can be supplied to the Excel Imaginary function as any of the following:

  • A simple number;
  • A complex number encased in quotation marks - e.g. "5+3i";
  • A reference to a cell containing a complex number or a numeric value;
  • A value returned from another Excel function or formula.

Excel Imaginary Function Examples

In the example spreadsheet below, the Excel Imaginary function is used find the imaginary coefficient of five different complex numbers.

 Formulas:
  A B
1 5+2i =IMAGINARY( A1 )
2   =IMAGINARY( "2-i" )
3   =IMAGINARY( 6 )
4   =IMAGINARY( "3i" )
5   =IMAGINARY( COMPLEX( 4, 1 ) )
 Results:
  A B
1 5+2i 2
2   -1
3   0
4   3
5   1

Note that, in the above example spreadsheet:


Further details of the Excel Imaginary function are provided on the Microsoft Office website.


Imaginary Function Errors

If you get an error from the Excel Imaginary Function, this is likely to be one of the following:

Common Errors
#NUM! - Occurs if the supplied inumber argument is not recognised as a complex number.
#VALUE! - Occurs if the supplied inumber argument is a logical value.