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)| Argument | What it means | |
|---|---|---|
inumber | Required | A 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
| A | B | |
|---|---|---|
| 1 | Complex | |
| 2 | 3+4i | 2.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
| A | B | |
|---|---|---|
| 1 | Value | |
| 2 | 8 | 3 |
Result: 3
2³ = 8, so the result is the text 3. Use =LOG(A2, 2) if you want a number for real inputs.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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.
| Language | Function name |
|---|---|
| Danish | IMAGLOG2 |
| Dutch | C.LOG2 |
| Finnish | KOMPLEKSI.LOG2 |
| French | COMPLEXE.LOG2 |
| Hungarian | KÉPZ.LOG2 |
| Italian | COMP.LOG2 |
| Polish | LOG2.LICZBY.ZESP |
| Russian | МНИМ.LOG2 |
| Spanish | IM.LOG2 |
| Turkish | SANLOG2 |