LOG Function Examples – Excel, VBA, & Google Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the LOG Function in Excel to calculate the logarithm of a number to a specified base.
LOG Function
The LOG Function returns the logarithm of a number to the specified base.
=LOG(64,4)
LOG Function – Base 10
The LOG Function will return the logarithm of a number to base 10 if the second argument is omitted.
=LOG(1000)
Alternatively, the LOG10 Function can also be used. To learn more, click here.
LOG Function – Base ‘e’
The LOG Function can return the logarithm of a number to base ‘e’.
=LOG(5, EXP(1))
Alternatively, the LN Function can also be used. To learn more, click here.
LOG & POWER Function
The LOG Function is a reverse of the POWER Function. The LOG Function returns the power to which the given base was raised.
Let’s say we raise 7 to the power of 3.
=POWER(7,3)
The resulting number when entered in the LOG Function to the base 7 will return the power.
=LOG(343,7)
LOG Function – Negative Number/Zero
The LOG Function will return an error if the argument is zero or a negative number.
=LOG(0)
=LOG(-5)
LOG in Google Sheets
The LOG Function works exactly the same in Google Sheets as in Excel:
LOG Examples in VBA
You can also use the LOG function in VBA. Type:
application.worksheetfunction.log(number,base)