Purpose

Return value

Syntax

=BITXOR(number1,number2)
  • number1 - A positive decimal number.
  • number2 - A positive decimal number.

Using the BITXOR function

The input numbers must be greater than or equal to zero and no larger than 2^48 - 1.

Difference Between OR and XOR

When a waiter in a breakfast diner asks if you want coffee OR orange juice, they are really asking if you want coffee XOR juice. You can have one or the other, but not both.

Purpose

Return value

Syntax

=COMPLEX(real_num,i_num,[suffix])
  • real_num - The real part of the complex number.
  • i_num - The imaginary part of the complex number.
  • suffix - [optional] The suffix for the imaginary unit, either “i” or “j”.

Using the COMPLEX function

The COMPLEX function returns the string representation of a complex number. For example:

=COMPLEX(4,3) // returns "4+3i"

To use the “j” instead of “i”:

=COMPLEX(4,3,"j") // returns "4+3j"

To enter the value of a complex number without using the COMPLEX function, write it in a formula like this:

="4+3i"

Explanation

The Excel formula engine handles complex numbers as strings formatted like “x+yi” or “x+yj”. For example, when we add two complex numbers together using the IMSUM function, the complex numbers are passed to the function as strings, and the result is a string representing the complex number that is the sum.

=IMSUM("4+3i","2-5i") // returns "6-2i"

We can perform the same operation using COMPLEX to get the strings representing the complex numbers.

=IMSUM(
COMPLEX(4, 3),
COMPLEX(2,-5)
) // returns "6-2i"

In general, the COMPLEX function is useful when you already have a complex number’s real and imaginary values and want its string representation.

Notes:

  1. If omitted, the suffix defaults to “i”.
  2. The suffix must be lowercase “i” or “j”; other values result in a #VALUE error.
  3. If real_num or i_num are non-numeric, COMPLEX returns the #VALUE! error