Math & trig function

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])
ArgumentWhat it means
numberRequiredA positive number.
baseOptionalThe 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

B5fx=LOG(B3/B2, 1+B4)
AB
1InputValue
2Today10000
3Goal20000
4Annual return0.06
511.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

C2fx=LOG(B2, 2)
ABC
1EventTeams
2Office football cup646

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

A1fx=LOG(1000)
A
13

Result: 3

10³ = 1000.

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

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
CzechLOGZ