Returns the logarithm of a number to a specified base. If base is omitted, defaults to 10. LOG(number, base) or LOG(number) for base-10. Essential for logarithmic calculations, scientific computing, and mathematical analysis.
Master the fundamentals of Excel LOG function
The LOG function returns the logarithm of a number to a specified base. LOG(number, base) calculates log_base(number). If base is omitted, it defaults to 10: LOG(number) = LOG(number, 10). Key properties: LOG(1, base) = 0 for any base, LOG(base, base) = 1, LOG(x, base) = LN(x) / LN(base) (change of base formula). Essential for logarithmic calculations with any base, scientific computing, data analysis, and mathematical transformations.
Works with any positive base (except 1)
Defaults to base 10 if omitted
Input must be > 0
Can convert between bases
Function-specific parameters
Function-specific return type
Logarithmic calculations with any base
Log transformations and scaling
Base-2 logarithms for binary
Logarithmic functions and models
Exact matching required
Returns numeric position
Handles missing text gracefully
=LOG(number, base)The positive number for which you want the logarithm.
The base of the logarithm. If omitted, base 10 is used.
The logarithm to the specified base
Description: Returns the logarithm of a number to a specified base
LOG defaults to base 10
Returns 2 because LOG(100) = log₁₀(100) = 2. 10² = 100, so the logarithm base 10 of 100 is 2.
Use LOG function in VBA
' Basic LOG in VBA (base 10)
Range("C1").Value = Application.WorksheetFunction.Log(100)
' Returns: 2
' Calculate logarithm with base
Sub CalculateLOG()
Dim number As Double
Dim base As Double
number = Range("A1").Value
base = Range("A2").Value
Dim result As Double
result = Application.WorksheetFunction.Log(number, base)
Range("B1").Value = result
End Sub
' Calculate base-2 logarithm
Sub CalculateBinaryLOG()
Dim number As Double
number = Range("A1").Value
Dim result As Double
' Base 2
result = Application.WorksheetFunction.Log(number, 2)
Range("B1").Value = result
End Sub
' Calculate base-e (natural log)
Sub CalculateNaturalLOG()
Dim number As Double
number = Range("A1").Value
Dim e As Double
e = Application.WorksheetFunction.Exp(1)
Dim result As Double
result = Application.WorksheetFunction.Log(number, e)
Range("B1").Value = result
' Equivalent to LN(number)
End Sub
' Convert between bases using change of base
Sub ChangeOfBase()
Dim number As Double
Dim newBase As Double
number = Range("A1").Value
newBase = Range("A2").Value
' LOG(x, b) = LN(x) / LN(b)
Dim result As Double
result = Application.WorksheetFunction.Ln(number) / _
Application.WorksheetFunction.Ln(newBase)
Range("B1").Value = result
End SubCommon logarithm calculations
Base-2 for binary calculations
Logarithm with any base
Logarithmic transformations
LOG returns #NUM! for zero or negative numbers
=IF(A1>0, LOG(A1, B1), "Invalid")Solution: LOG only works with positive numbers. LOG(0) and LOG(negative) return #NUM!. Ensure input is > 0. Check for negative values or zero in your data.
Non-numeric input in LOG
=LOG(VALUE(A1), VALUE(B1))Solution: Ensure input is numeric. LOG requires positive numbers. Check for text, errors, or empty cells. Use VALUE() if needed.
Base must be positive and not equal to 1
Ensure base > 0 and base ≠ 1Solution: Base must be > 0 and ≠ 1. LOG(number, 1) returns #NUM!. Use valid base values.
Uncertainty about default base
LOG(100) = LOG(100, 10) = 2Solution: If base is omitted, LOG defaults to base 10. LOG(number) = LOG(number, 10). Use explicit base if you need a different one.