How to use the LOG function
What is the LOG function?
The LOG function calculates the logarithm of a number to a specific base. The log function uses base 10 if a base is not specified.
1. Introduction
What is a logarithm?
A logarithm is a mathematical operation that tells you how many times you need to multiply a certain number, called the base, by itself to get another number.
For example, if you want to know how many times you need to multiply 2 by itself to get 16: 2x = 16
you can use a logarithm with base 2 and write it as log2(16) which equals 4.
Now we know the exponent: 24 = 16 or 2 * 2 * 2 * 2 = 16
What is a base?
In logarithms, the base is the number that is raised to a power to produce the desired output. It is the foundation of the logarithmic function.
For example, the logarithm log10(100):
- 10 is the base
- 100 is the input number
- 2 is the exponent that makes 10 return 100 because 102 = 100
The most common bases are
- 10
- e (natural log), and
- 2 (for computers).
But any positive number besides 1 can be a base.
What is an exponent?
An exponent is a number that indicates the power or times that a base number is multiplied by itself.
Exponents are written as a small raised number, like x2, y3, or 104. The base number is being multiplied by itself as many times as the exponent value. Exponents are also referred to as "raising to a power".
What is the definition of a logarithm with an arbitrary base?
A logarithm with an arbitrary base b can also be defined using a limit definition, similar to how the natural logarithm is defined:
For a base b > 0, b ≠ 1:
logb(x) = lim (n->infinity) (x^(1/n) - 1) * n / logb(e)
Where:
- b is the base
- x is the input number
- e is the mathematical constant
Here is an example:
b = 3
x = 100
e = 2.718281828
n = large number, here I use 99999999
(100^(1/99999999) - 1) * 99999999/ log3(e) = 4.191806641
=LOG(100,3) returns 4.191806549
What are the other logarithmic functions in Excel?
Excel function | Description |
---|---|
LOG | Returns the logarithm with a given base. |
LN | Returns the natural logarithm (base e) of a number |
LOG10 | Returns the base-10 logarithm of a number |
LOG2 | Returns the base-2 logarithm of a number |
The corresponding inverse functions for the logarithm functions in Excel:
Logarithm | Power to |
---|---|
LOG | Arbitrary base, basex or POWER(number, power) |
LN | EXP(number) |
LOG10 | 10x or POWER(10,x) |
LOG2 | 2x or POWER(2,x) |
2. Syntax
LOG(number, [base])
number | Required. The positive numerical value for which you want the logarithm. |
[base] | Optional. The base of the logarithm. Default value is 10. |
3. Example 1
This example shows how to calculate the logarithms based on a specified value and a given base. The arguments are populated in cell range B3:C6:
- number: B3:B6
- [base]: C3:C6
The first value is 1000 (number) and the base is 10, the function in cell E3 returns 3 which represents the logarithm. This means that 10^3 = 1000.
Formula in cell E3:
The number argument is in cell B3 and the [base] argument is in cell C3.
The second value is 10 which is the number argument and the base is 2, the function in cell E4 returns approx. 3.32 which represents the logarithm. This means that 2^3.32 = 10.
Formula in cell E4:
The number argument is in cell B4 and the [base] argument is in cell C4.
The third value is 9 and the base is 3. The number argument is in cell B5 and the [base] argument is in cell C5.
Formula in cell E5:
The function in cell E5 returns 2 which represents the logarithm. This means that 3^2 = 9.
The fourth value is 100 and the base is 4. The number argument is in cell B6 and the [base] argument is in cell C6.
Formula in cell E6:
The function in cell E6 returns approx. 3.32 which represents the logarithm. This means that 4^3.32 = 100.
4. Example 2
How many hours will it take for a bacteria population to grow from 1,000 cells to 4,000 cells if it triples every hour?
Here are the key parameters:
- Start population: 1,000 cells (This is the initial amount of bacteria cells)
- End population: 4,000 cells (This is the final number of cells)
- Growth: 3x per hour (This constant tells us how fast the bacteria population grows per hour)
Here are the LOG function arguments:
- number: The ratio between the final population and the start population is 4,000/1,000 equals 4 or if we use cell references: C20/C19
- [base]: The growth rate per hour is our base.
Formula in cell E23:
The formula in cell E23 returns 1.26 which represents the number of hours it takes for the bacteria population to grow to 4,000 cells.
The image above shows a chart that displays the population growth across hours, the blue line represents the bacteria population from 0 to 2 hours. The red vertical line shows 1.26 on the x-axis, find the intersection with the blue line. Go with the horizontal line to the y axis on the left side and you will find the value 4,000.
5. Example 3
How many years will it take for an initial investment of 10,000 to reach 37,500 if the interest rate is 5% per year?
Here are the key parameters:
- Present value: 10,000 cells (This is the initial investment)
- End population: 37,500 cells (This is the final number of cells)
- Rate : 5% (The investment accumulates each year by 1 + 0.05 = 1.05)
Here are the LOG function arguments:
- number: The ratio between the investment goal and the initial investment 37,500/10,000 equals 3.75 or if we use cell references: C20/C19
- [base]: The growth rate per year is our base which in this case is 1.05
Formula in cell E23:
The formula in cell E23 returns 27.09 which represents the number of years it takes for the present value to reach 37,500.
The picture shows a graph that illustrates the investment growth across years, the blue line represents the investment amount from 0 to 40 years. The red vertical line shows 27.09 on the x-axis, find the intersection with the blue line. Go with the horizontal red line to the y axis on the left side and you will find the value 37,500.
Useful links
Logarithm - wikipedia
Euler's Number - UTSA
Functions in 'Math and trigonometry' category
The LOG function function is one of 62 functions in the 'Math and trigonometry' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form