LOG function
Returns the logarithm of a number to a base you choose (base 10 if omitted).
Available in All versions of Excel, Excel for the web, Excel for Mac
In every Excel versionWorks in Google Sheets
Syntax
LOG(number, [base])| Argument | What it means | |
|---|---|---|
number | Required | A positive number. |
base | Optional | The base of the logarithm. Default 10. Must be positive and not 1. |
Returns: The power to which base must be raised to get number.
How LOG works
LOG reverses a power: if 2⁶ = 64, then LOG(64, 2) = 6. That makes it the tool for "how many times" or "how many periods" questions: how many years until an investment doubles at 6%, how many rounds a knockout tournament of 64 teams needs, how many halvings until a value drops below a limit.
Without the second argument LOG uses base 10, like LOG10. For base e use LN. The number must be positive and the base positive and different from 1. A useful identity: LOG(x, b) = LN(x)/LN(b), so any base can be handled with either function.
Examples
1Years to reach a savings goal
| A | B | |
|---|---|---|
| 1 | Input | Value |
| 2 | Today | 10000 |
| 3 | Goal | 20000 |
| 4 | Annual return | 0.06 |
| 5 | 11.90 |
Result: 11.90
Solving 1.06ⁿ = 2 gives n ≈ 11.90 years (2 decimals). NPER gives the same answer for this simple case.
2Rounds in a knockout tournament
| A | B | C | |
|---|---|---|---|
| 1 | Event | Teams | |
| 2 | Office football cup | 64 | 6 |
Result: 6
Each round halves the field: 64 → 32 → 16 → 8 → 4 → 2 → 1, so 6 rounds. Use ROUNDUP(LOG(B2,2),0) when the number of teams is not a power of 2.
3Base 10 by default
| A | |
|---|---|
| 1 | 3 |
Result: 3
10³ = 1000.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | Number or base is zero or negative. | Use positive values. |
#DIV/0! | Base is 1. | Choose a different base. |
Tips
- Digits in a positive whole number:
=INT(LOG(x))+1. - Floating point can return 2.9999999999 for exact powers; wrap in ROUND before using INT.
Google Sheets
LOG also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
LOG 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 |
|---|---|
| Czech | LOGZ |