Engineering function

IMLOG2 function

Returns the base-2 logarithm of a complex number, ln(z)/ln(2).

Available in Excel 2007 and later (Excel 2003 needed the Analysis ToolPak add-in), Microsoft 365, Excel for the web, Excel for Mac

Excel 2007 and laterWorks in Google Sheets

Syntax

IMLOG2(inumber)
ArgumentWhat it means
inumberRequiredA complex number as text such as "3+4i" or "5-2j", a cell containing one, or a plain number. Build it with COMPLEX to avoid typing errors.

Returns: A complex number as text.

How IMLOG2 works

IMLOG2 returns the binary (base-2) logarithm of a complex number: the natural logarithm from IMLN divided by ln 2. The real part is log₂ of the size and the imaginary part is the angle divided by ln 2 (about 0.6931).

Base-2 logs appear in information theory and in octave-based scales in acoustics and music. For a real positive number IMLOG2 simply returns how many times you double 1 to reach it, as text. Like all IM functions, it reads complex numbers written as text (x+yi or x+yj) and returns its answer as text with up to 15 significant digits, so you can feed the result straight into another IM function.

Examples

1Log base 2 of 3+4i

B2fx=IMLOG2(A2)
AB
1Complex
23+4i2.32192809488736+1.33780421245098i

Result: 2.32192809488736+1.33780421245098i

log₂(5) = 2.3219… and 0.927295 / ln 2 = 1.3378…, shown with 15 significant digits.

2A power of two

B2fx=IMLOG2(A2)
AB
1Value
283

Result: 3

2³ = 8, so the result is the text 3. Use =LOG(A2, 2) if you want a number for real inputs.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 13 KB

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The input is 0 or not a valid complex number.Check the value.
#VALUE!The argument is a logical value, or the formula mixes the i and j suffixes.Use one suffix consistently throughout a calculation.

Tips

  • The result is text even when it looks like a whole number; wrap it in IMREAL to get a number.

Google Sheets

IMLOG2 also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

IMLOG2 in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishIMAGLOG2
DutchC.LOG2
FinnishKOMPLEKSI.LOG2
FrenchCOMPLEXE.LOG2
HungarianKÉPZ.LOG2
ItalianCOMP.LOG2
PolishLOG2.LICZBY.ZESP
RussianМНИМ.LOG2
SpanishIM.LOG2
TurkishSANLOG2