Example 1
Base 10 by default
B2 =LOG(A2)
Result: 3
10 x 10 x 10 is 1,000, so the base-10 logarithm is 3.
B2 =LOG(A2) returns 3
Returns the logarithm of a number to a base you choose. With no base it uses 10, so LOG(1000) is 3.
Syntax
=LOG(, )
All versions of Excel.
Try it
Edit the formula in B2 or change the inputs. The sheet recalculates as you type.
B2 =LOG(A2) returns 3
LOG answers the question "what power do I raise the base to in order to get this number?". =LOG(1000) is 3, because 10 to the power 3 is 1,000. =LOG(8, 2) is 3, because 2 to the power 3 is 8.
With one argument LOG uses base 10, the common logarithm. The second argument changes the base: 2 for binary and doubling problems, 1.05 for 5% growth per period, or any other positive number except 1. For base e, use LN or =LOG(x, EXP(1)). A dedicated LOG10 function exists too, and is the same as LOG with one argument.
For a positive whole number, =INT(LOG(B2))+1 returns the count of digits. LOG10 of 98,765 is 4.99, INT gives 4, and adding 1 gives 5. Use =LEN(B2) if you are happy to treat the number as text.
LOG with a growth factor as the base returns the number of periods. How many years for 2,000 to grow to 5,000 at 6% a year? =LOG(5000/2000, 1.06) is about 15.7, so the target is reached during year 16. Wrap it in ROUNDUP when you need whole periods. Also useful: the number of doublings needed to grow by a factor, =LOG(factor, 2).
Logarithms compress large ranges. =LOG(B2) turns 10, 1,000 and 100,000 into 1, 3 and 5, so values that differ by orders of magnitude can share one chart axis. In practice, set the chart axis to a logarithmic scale and keep the original numbers.
=LN(x)/LN(base) is the same as =LOG(x, base), which is how you do it in other tools.=10^LOG(x) or =POWER(base, LOG(x, base)) returns x.The number must be positive, and the base must be positive and not 1. Zero, negatives and a base of 1 return #NUM! or #DIV/0!. Text returns #VALUE!.
B2. Zero or a negative number returns #NUM!.2 or 1.05. If you leave it out, it is 10. It must be positive and not 1.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
B2 =LOG(A2)
Result: 3
10 x 10 x 10 is 1,000, so the base-10 logarithm is 3.
B2 =LOG(A2) returns 3
Example 2
C2 =LOG(A2,B2)
Result: 3
2 x 2 x 2 is 8, so it takes 3 doublings to reach 8.
C2 =LOG(A2,B2) returns 3
Example 3
B2 =LOG(A2)
Result: -2
A number below 1 has a negative logarithm. 10 to the power -2 is 0.01.
B2 =LOG(A2) returns -2
Example 4
B2 =INT(LOG(A2))+1
Result: 5
LOG(98765) is about 4.99. INT keeps 4, and adding 1 gives the 5 digits.
B2 =INT(LOG(A2))+1 returns 5
Example 5
D2 =ROUNDUP(LOG(B2/A2,1+C2),0)
Result: 16
LOG(2.5, 1.06) is about 15.7, so the target is passed during the 16th year.
D2 =ROUNDUP(LOG(B2/A2,1+C2),0) returns 16
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B2, return how many digits the whole number in A2 has, using a logarithm. Fill it down to B6.
Answer in B2, then it fills down to B6.
LOG(100) is 2. For the natural logarithm, use LN.#NUM!. A base of 1 also fails, since no power of 1 changes the number.1+rate, not the rate. LOG(2.5, 0.06) gives a negative number.It returns the power you raise a base to in order to get a number. LOG(1000) is 3 and LOG(8, 2) is 3. With no base it uses 10.
LN is always base e, about 2.718. LOG defaults to base 10 and accepts any base as its second argument.
Use the second argument: `=LOG(8, 2)`. The same result is `=LN(8)/LN(2)`.
Use `=LOG(target/start, 1+rate)`, wrapped in ROUNDUP for whole periods. From 2,000 to 5,000 at 6% gives about 15.7.
The number is zero or negative, or the base is negative. Logs are defined only for positive numbers. A base of 1 also fails.
Tracks take you from the basics to modelling, one graded exercise at a time.