LOG

Math & Trigonometry Functions
(4.7/5)

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.

Interactive Formula Tester

=LOG("100")

Complete Theory & Understanding

Master the fundamentals of Excel LOG function

Core Concept

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.

Why Use LOG?

  • Logarithmic calculations with any base
  • Log transformations and scaling
  • Base-2 logarithms for binary
  • Logarithmic functions and models

Key Characteristics

Flexible Base

Works with any positive base (except 1)

LOG(8, 2) = 3

Default Base 10

Defaults to base 10 if omitted

LOG(100) = 2

Only Positive Numbers

Input must be > 0

LOG(0) = error

Change of Base

Can convert between bases

LOG(x, b) = LN(x) / LN(b)

Function Anatomy

=LOG(parameters...)
Required
Parameters:

Function-specific parameters

Returns
Return Value:

Function-specific return type

Primary Use Cases

Scientific Computing

Logarithmic calculations with any base

Data Analysis

Log transformations and scaling

Binary Calculations

Base-2 logarithms for binary

Mathematical Analysis

Logarithmic functions and models

Theory Summary

Precise

Exact matching required

Position-Based

Returns numeric position

Error-Safe

Handles missing text gracefully

Syntax & Parameters

=LOG(number, base)
Required
number:

The positive number for which you want the logarithm.

Optional
base:

The base of the logarithm. If omitted, base 10 is used.

Returns
Return Value:

The logarithm to the specified base

Description: Returns the logarithm of a number to a specified base

Interactive Examples

Basic LOG (Base 10)

LOG defaults to base 10

"100"
=LOG(100)
2

Returns 2 because LOG(100) = log₁₀(100) = 2. 10² = 100, so the logarithm base 10 of 100 is 2.

VBA Implementation & Automation

Basic LOG in VBA

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 Sub

Business Applications

Base-10 Logarithms

Common logarithm calculations

=LOG(1000)

Binary Logarithms

Base-2 for binary calculations

=LOG(8, 2)

Custom Base

Logarithm with any base

=LOG(number, base)

Mathematical Analysis

Logarithmic transformations

=LOG(data, base)

Common Issues & Solutions

#NUM! Error

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.

#VALUE! Error

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.

Invalid Base

Base must be positive and not equal to 1

Ensure base > 0 and base ≠ 1

Solution: Base must be > 0 and ≠ 1. LOG(number, 1) returns #NUM!. Use valid base values.

Default Base Confusion

Uncertainty about default base

LOG(100) = LOG(100, 10) = 2

Solution: If base is omitted, LOG defaults to base 10. LOG(number) = LOG(number, 10). Use explicit base if you need a different one.

Performance Tips & Best Practices

⚡ Performance Optimization

  • LOG is fast - minimal performance impact
  • Use LOG10 for base-10 (slightly faster than LOG(number))
  • Round results only for display, not in calculations
  • LOG works efficiently in array formulas
  • Validate input is positive before calculation

🎯 Best Practices

  • Remember LOG(1, base) = 0 for any valid base
  • Input must be positive (> 0)
  • Base must be positive and ≠ 1
  • If base omitted, defaults to 10
  • Test with known values: LOG(100) = 2
  • Use LOG for flexible base calculations
  • Document base when using LOG
  • LOG(number, EXP(1)) = LN(number)