LOG function
LOG returns the logarithm of a number in the base you choose: the power the base must be raised to in order to reach the number. Leave the base out for base 10. It answers questions like "how many years until this doubles?" with =LOG(2,1+rate).
- Available in
- Every current version
- Category
- Math functions
- Returns
- The logarithm of number in base.
- Google Sheets
- Works the same in Google Sheets.
Syntax
=LOG(number, [base])
| Argument | Required? | What it is |
|---|---|---|
number | Required | A positive number. |
base | Optional | The base of the logarithm. Leave it out for base 10. |
Examples
Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | =LOG(B2) | 3 | No base given, so base 10: 1,000 is 10 to the 3rd |
| D3 | =LOG(B3,2) | 6 | Base 2: 64 is 2 to the 6th |
| D4 | =LOG(2,1+B4) | 10.24476835 | Years to double at 7% growth: about 10.2 |
Try it live
This is the sample sheet. Change any number or text, or edit a formula, and the results update.
Show the sample data as a table
| Input | Value | ||
| Number | 1000 | 3 | |
| Bits | 64 | 6 | |
| Growth rate | 7% | 10.24476835 |
Practice LOG
Graded instantly, then re-checked on changed data.
Years to reach the target
In
E2, use LOG to find how many years each balance needs to reach its target at the annual return shown: the log of target ÷ balance, in base 1 + return. Fill down to E6.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| #NUM! | number or base is zero or negative. Logarithms only exist for positive numbers. |
| #DIV/0! | The base is 1, which can't be used as a logarithm base. |
| Expected the natural log | LOG defaults to base 10, not e. Use LN for natural logs. |
Tips
- Years to reach a target: =LOG(Target/Start,1+Rate).
Questions
How do I calculate log base 2 in Excel?
Use =LOG(A2,2).
What base does LOG use by default?
Base 10. =LOG(100) returns 2.
How do I find how long it takes to double my money?
Use =LOG(2,1+rate). At 7% that's about 10.2 years.
Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.