LOG function

LOG returns the logarithm of a number to a specified base (default base 10), used to convert exponential relationships into linear scales.

=LOG(number, [base])

Generate a LOG formula

Describe what you need. The generator will reach for LOG where LOG is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How LOG reads its arguments
numberrequiredbaseoptionalLOG
ArgumentRequiredDescription
numberRequiredA positive number for which you want the logarithm. Returns #NUM! if number is zero or negative.
baseOptionalOptional. The base of the logarithm; defaults to 10 if omitted. Must be positive and not equal to 1, or returns #DIV/0!.

Returns

A number representing the logarithm of the input.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Scale order quantities logarithmically for comparison

Order IDUnits
100115
10028
100322
=LOG(B2)

Result: 1.176 (for order 1001 with 15 units)

LOG(15) calculates the base-10 logarithm of 15 units, returning 1.176. This compresses larger unit quantities into a comparable scale for visualization or analysis, so that 8 units (0.903) and 22 units (1.342) can be meaningfully compared on the same chart without extreme ranges.

2. Find which power of 2 yields a unit price

Order IDUnit Price
100124.50
100445.00
100618.75
=LOG(E2,2)

Result: 4.616 (for order 1001 with unit price 24.50)

LOG(24.50, 2) asks 'what power must 2 be raised to in order to get 24.50?' The answer is 4.616. This is useful for exponential scaling models where you need to reverse-engineer the exponent, such as analyzing pricing tiers that double at each level.

3. Analyze order value growth using aggregate logarithmic scaling

Order IDRegionUnits
1001East15
1002West8
1003South22
1004North5
=LOG(SUM(C2:C5),10)

Result: 1.699 (for the sum of 50 units across four orders)

LOG(SUM(C2:C5), 10) sums the units in four orders (15+8+22+5=50) and returns its base-10 logarithm (1.699). This condenses large aggregate volumes into a workable scale for reporting, making it easier to spot 10x changes in order volume across time periods or regions.

Common errors

Which LOG error are you seeing?
LOG returned an error#NUM!
Use ABS() to convert negative values to positive: =LOG(ABS(E2)). Or filter out rows with zero or negative values before applying LOG.
#DIV/0!
Ensure the base argument is not 1. If constructing base dynamically (e.g., =LOG(15, B2)), add a check: =IF(B2=1, "N/A", LOG(15, B2)).
#VALUE!
Verify that both arguments are numeric. Use IFERROR to catch text: =IFERROR(LOG(E2), 0). Or convert text with VALUE() if needed: =LOG(VALUE(E2)).
ErrorWhy it happensHow to fix it
#NUM!LOG cannot calculate the logarithm of zero or negative numbers. If a unit quantity or unit price is zero or negative (e.g., a refund represented as a negative value), LOG will fail.Use ABS() to convert negative values to positive: =LOG(ABS(E2)). Or filter out rows with zero or negative values before applying LOG.
#DIV/0!LOG returns #DIV/0! when base is 1. The logarithm base-1 is undefined because 1 raised to any power always equals 1, making the inverse relationship impossible.Ensure the base argument is not 1. If constructing base dynamically (e.g., =LOG(15, B2)), add a check: =IF(B2=1, "N/A", LOG(15, B2)).
#VALUE!LOG receives a non-numeric value for either the number or base argument. This occurs if you reference a text cell (e.g., a rep name like 'Sarah') or a formatted text number instead of a numeric value.Verify that both arguments are numeric. Use IFERROR to catch text: =IFERROR(LOG(E2), 0). Or convert text with VALUE() if needed: =LOG(VALUE(E2)).

Tips and when to use something else

  • For the integer portion only, use INT(LOG(number)) or TRUNC(LOG(number)) to avoid rounding.
  • LOG is the inverse of exponentiation: if LOG(100, 10) = 2, then 10^2 = 100. Use this to reverse-engineer exponential relationships in your data.
  • For large datasets, prefer ROUND(LOG(number), 2) to limit decimal places and improve readability in reports.
  • For handling negative numbers or refunds, wrap with ABS(): =LOG(ABS(number)) converts them to positive values before calculating logarithms.

Frequently asked questions

What's the difference between LOG and using INT to get a whole number?
LOG calculates the logarithm (which is almost always a decimal), while INT extracts just the integer part. LOG(100)=2, but LOG(50)≈1.699, and INT(LOG(50))=1. Use INT() when you need only the whole-number portion; use LOG() alone when decimal precision matters for calculations.
Can I use LOG with negative numbers or zero?
No. LOG of any number ≤ 0 returns #NUM! because logarithms are undefined for zero and negative numbers in real mathematics. Convert negatives with ABS() if needed: =LOG(ABS(number)).
How do I use LOG to reverse an exponential calculation?
If you know that a value was calculated as base^exponent, use LOG to recover the exponent: exponent = LOG(value, base). For instance, if 2^x = 64, then x = LOG(64, 2) = 6.
What should I use to handle errors when LOG fails on unexpected negative values?
Use IFERROR() to catch #NUM! errors: =IFERROR(LOG(E2), "invalid"). This returns "invalid" when LOG fails, preventing errors from cascading through your calculations. Alternatively, wrap with ABS(): =LOG(ABS(E2)).

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17