The LOG function will calculate the logarithm of any given number to a specified base.

## Contents:

__3.1. Calculating Th____e Common, Natural, and Binary Logarithm of a Number__

## Syntax

`= LOG(`*number,[base*])

*number -* a positive number you wish to return the logarithm of

[*base*] - The base of the logarithm. If left blank will default to base 10

### Explanation

The LOG function is part of the "Math and Trigonometry" group of functions within Excel.

A logarithm is a mathematical concept and operation that helps us determine the exponent or power to which a specific base must be raised to obtain a given number. In simpler terms, it is the inverse operation of exponentiation.

This function differs from LOG10 as we can define which base is used for each logarithm. When you change the base of a logarithm, you change the power to which the new base must be raised to obtain the given number.

__Different bases are used for different purposes:__

Common logarithm (base 10): This is the most widely used logarithm in mathematics, engineering, and various sciences. It is especially convenient for working with numbers expressed in the decimal system since the logarithm of a power of 10 is an integer.

Natural logarithm (base e): The base e (approximately 2.718) is used for natural logarithms, which are common in calculus, statistics, and many other scientific applications. The natural logarithm is denoted as ln(x) or log_e(x).

Binary logarithm (base 2): The binary logarithm is used in computer science, information theory, and some mathematical applications. It is especially helpful when working with binary data or power-of-two operations.

*Note:*

- If the input number is not a number, a #NAME! error will be returned

- If the input is a negative number, a #NUM! error will be returned

- If no *base* argument is used, the function will default to base 10, or a common logarithm

### Examples

## How to Calculate the Common, Natural, and Binary Logarithm of a Number

In this example, let's take a look at the 3 most common types of logarithms, a common logarithm, natural logarithm, and binary logarithm.

In column B, we have the numbers that we want to return the logarithm of, and in column C, we have the base for each logarithm. By using the following formula, we can easily calculate each of the three logarithms:

`= LOG(`*number*, *base*)

`= LOG(B3, C3)`