Log in Excel: A Simple Guide
Use LOG, LOG10 and LN in Excel and Google Sheets: the syntax, the default base, log base 2, antilogs with POWER and EXP, and fixes for #NUM! errors.
LOG(number, [base]) in Excel and Google Sheets
To compute a logarithm in Excel or Google Sheets, use the LOG function. The syntax is LOG(number, base). The number is your argument, the base is the logarithm's base. If you omit the base in Excel, it defaults to 10, giving you a common logarithm. In Google Sheets, the base argument is required, so you must supply it. For example, LOG(100, 10) returns 2 because 10² equals 100. LOG(8, 2) returns 3 because 2³ equals 8. This is the primary way to log in Excel for any base not covered by the dedicated functions below. The most common mistake is thinking LOG returns a variable; it returns a number, the exponent needed to raise the base to reach the argument. Both Microsoft Support and Google Docs Editors Help confirm the argument must be greater than 0 and the base must be positive and not equal to 1. If you supply a zero or negative argument, you get a #NUM! error. If you supply text, you get a #VALUE! error.
Google Sheets LOG Syntax Difference
In Google Sheets, type =LOG(100, 10) to get 2. The base is mandatory. In Excel, =LOG(100) also returns 2 because the base defaults to 10. If you write =LOG(100, 10) in Excel, it works identically. This is the only syntax difference between the two spreadsheet applications for logarithm functions. For chemistry students calculating pH, where pH = -log₁₀([H+]), you would write =-LOG(B2, 10) in Google Sheets, or =-LOG(B2) in Excel. The same formula applies to the Richter scale, where magnitude is the base-10 log of amplitude ratio.
LOG10 and LN
Use LOG10(number) for a base-10 logarithm, also called the common logarithm. This is a dedicated function, so you do not need to specify the base. LOG10(100) returns 2. It is identical to LOG(number, 10) but saves typing. Microsoft Support documents LOG10 with the same argument restriction: number must be greater than 0.
Use LN(number) for the natural logarithm, base e, where e is Euler's number, approximately 2.71828. LN returns the exponent to which e must be raised to get the number. LN(1) returns 0; LN(e) returns 1. The natural log is standard in pure mathematics, financial modeling with continuous compounding, and any field using exponential decay or growth. Do not confuse LN with LOG10: they are different functions with different bases. Using LN when you need LOG10, for example in a pH calculation, gives a wrong answer by a factor of about 2.3026. The TI-84 Plus CE calculator has separate keys for log₁₀ and ln, and spreadsheets follow the same convention. For the change of base formula, you would write LN(number)/LN(base) to compute a logarithm in any base, but the LOG function with a base argument is simpler.
Log Base 2 in Excel
There is no dedicated LOG2 function in Excel or Google Sheets. Compute a binary logarithm using the LOG function with base 2: =LOG(number, 2). For example, =LOG(8, 2) returns 3. This is the standard method for computer science students analyzing algorithm complexity, where binary logarithms (log₂) are common. CLRS uses lg to mean log₂, though ISO 80000-2 defines lg as log₁₀. In spreadsheets, the notation is unambiguous: use base 2 explicitly. Estimating log₂(50) manually uses the fact that 2⁵ = 32 and 2⁶ = 64, so log₂(50) lies between 5 and 6, approximately 5.64. The spreadsheet returns the precise value.
Antilog: POWER and EXP
The antilog is the inverse of a logarithm. To compute 10 raised to a power, the antilog of a common log, use the POWER function or the ^ operator. =POWER(10, x) is the antilog of x in base 10. For natural logs, use =EXP(x), which returns e^x. For any base b, use =POWER(b, x). For example, if a log value is 3.45 in base 10, its antilog is =POWER(10, 3.45) which returns approximately 2818. This is the operation a four-figure log table user would perform by looking up the mantissa in the table and applying the characteristic. The inverse property is: b^(log_b(x)) = x.
ERRORS: #NUM! and #VALUE!
Two errors stop your log calculation. A #NUM! error occurs when the argument is zero or negative, because the real logarithm is undefined for x ≤ 0. A #VALUE! error occurs when you supply text instead of a number, or when the base is 1. Base 1 is invalid because 1^y equals 1 for every y, so it cannot produce any other number. A negative base also produces #NUM! for most arguments because the result is not a real number. If you get an error, check that the argument is positive and the base is positive and not 1.
| Input | Function | Error | Why |
|---|---|---|---|
| LOG(0) | LOG | #NUM! | Argument is zero; log of 0 is -∞, not a real number |
| LOG(-5) | LOG | #NUM! | Argument is negative; real logs require x > 0 |
| LOG("abc") | LOG | #VALUE! | Text argument; function expects a number |
| LOG(2, 1) | LOG | #NUM! | Base equals 1; 1^y = 1 for all y, never equals x |
| LOG(2, -1) | LOG | #NUM! | Negative base; real log is undefined for most arguments |
| LN(0) | LN | #NUM! | Same domain restriction as LOG |
| LOG10(-1) | LOG10 | #NUM! | Same domain restriction as LOG |
Logarithmic Scale Charts
Excel and Google Sheets can create charts with a logarithmic scale. On a chart's vertical or horizontal axis, set the scale to logarithmic instead of linear. This is useful when data spans several orders of magnitude. In Excel, right-click the axis, select Format Axis, and check Logarithmic Scale. In Google Sheets, open the Chart editor, go to the Customize tab, select Vertical axis, and check Log scale. A logarithmic scale means equal distances on the axis represent multiplicative factors, not additive ones. For example, the Richter scale and the decibel scale are logarithmic: a step of 1 on the Richter scale means 10 times the amplitude and about 31.6 times the energy. A logarithmic chart makes exponential trends appear as straight lines. Do not use a log scale when values include zero or negative numbers, because the log of zero is undefined; the chart will omit those points or fail.
Who the Subject Suits and Who Should Skip
Computing logs in a spreadsheet suits Algebra II and precalculus students solving exponential equations, chemistry students calculating pH from hydrogen ion concentration, computer science students analyzing algorithm complexity with base-2 logs, and adults in data analysis or financial modeling. Skip this if you are looking for the history of logarithms, biographies of Napier or Briggs, or the construction of a slide rule; those topics belong to the history of mathematics. Skip if you need advanced calculus involving natural log integrals or series expansions; those require a calculus textbook. The thing that most often goes wrong is assuming LOG and LN are interchangeable: using LN when LOG10 is needed for pH or the Richter scale yields a wrong result by a factor of about 2.3026, which is the natural log of 10.
Common Questions
What is the difference between LOG and LOG10 in Excel?
LOG(number, base) returns the logarithm with any base you specify. If you omit the base, it defaults to 10. LOG10(number) is a dedicated function that always returns base-10 logarithm. They produce the same result when the base is 10.
Can I compute a natural log in Google Sheets?
Yes. Google Sheets supports the LN function, identical to Excel's LN function. Use =LN(number) to get the natural logarithm.
What does log base 2 in Excel look like?
Use =LOG(number, 2). There is no separate LOG2 function. This returns the binary logarithm, used in computer science for algorithm complexity.
How do I compute the antilog of a value?
Use the POWER function: =POWER(10, x) for base-10 antilog, =EXP(x) for natural antilog, or =POWER(base, x) for any base.
Why does my LOG function give a #NUM! error?
The #NUM! error means the argument is zero or negative, or the base equals 1. Logarithms are only defined for positive arguments and a base that is positive and not 1.
Do Excel and Google Sheets LOG functions work the same?
Mostly. The main difference is that in Excel the base argument is optional and defaults to 10; in Google Sheets the base argument is required. Otherwise, the syntax and behavior are identical.
What is a logarithmic scale chart used for?
A logarithmic scale chart displays data that spans multiple orders of magnitude, such as earthquake magnitudes or sound intensity. The axis is scaled so that equal distances represent multiplicative factors, making exponential trends appear linear.