LOG

Return the logarithm of a number to a given base, or to base 10 when no base is given.

Syntax

LOG(number, [base])
Argument Required Description
number Required A positive number.
base Optional The base of the logarithm. Defaults to 10.

Examples

Every example below was executed against VisiGrid engine 0.54.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=LOG(100) 2 With no base, LOG is base 10.
=LOG(8,2) 3 Two cubed is eight.
=LOG(1024,2) 10 How many times 1,024 halves before it reaches 1.
=LOG(0) #NUM!
=LOG(10,1) #NUM! Base 1 is not a usable base.

The default base is 10

LOG(x) is base 10, matching Excel and Sheets. That catches out anyone coming from a programming language, where log(x) usually means the natural log. For base e use LN.

”How many times” questions

A logarithm answers how many times you multiply by the base to reach a number. Base 2 counts halvings and doublings:

=LOG(1024,2)  → 10

— ten rounds of a knockout tournament for 1,024 entrants, or ten binary-search steps through 1,024 sorted rows.

Errors

Zero and negative numbers have no logarithm, so they return #NUM!. So does a base of 1, and so does a zero or negative base. If a column feeding LOG can contain zeros, test for them before taking the log rather than after.

Excel compatibility

Matches Excel, including the default base of 10.

Related functions

Last updated