## Recipe 7.4. Exploring Exponential and Logarithmic Functions## ProblemYou need to compute logarithms in your calculations but aren't familiar with Excel's support for such calculations. ## SolutionExcel provides nine built-in functions for computing logarithms and one exponential function (excluding the special class of exponential functions known as hyperbolic functions, for which Excel provides six built-in functions). A few of these logarithm functions are related to the log-normal probability distribution, while others are related to complex numbers. See Chapter 6 for recipes dealing with probability and check out Recipe 7.13 for dealing with complex numbers. Read the following discussion to learn about the remaining logarithmic functions . ## DiscussionTable 7-4 shows several of Excel's built-in logarithmic and exponential functions.
These functions pretty much do what you'd expect functions related to logarithms and natural logarithms to do. You may wonder why there's a Excel also provides the exponential function Aside from straightforward logarithmic and exponential computations, these functions are useful when curve fitting. For example, you may have data through which you'd like to fit a logarithmic curve. You could use Excel's built-in logarithmic curve-fitting features (see Chapter 8) or you could transform the data and use Excel's linear curve-fitting functions. For example, LOG(x values)) uses Excel's linear curve-fitting function on the transformed data, which results in a logarithmic curve fit. Moreover, sometimes it's more convenient or insightful to plot the log of a dataset instead of the dataset in its original form. You can use these functions to transform your data as desired.Excel also has a function called is the power to which power will be raised. You can also use the ^ operator to raise a number to a power, as discussed in Recipe 1.9. Conversely, you can use nPOWER to reverse a LOG operation on a value. For example =POWER(10, LOG(3)) simply returns a value of 3.This all seems straightforward enough, and it is, but there's potential for confusion when working with Excel's built-in logarithmic functions and the LOG means base 10 log and LN means natural log.VBA does not provide another function for computing the base 10 logarithm of a number (or any other base, for that matter). However, when working in VBA you can compute the logarithm of a number to any base by taking the ratio of the natural logarithm of the number to the natural logarithm of the desired base. For example, to compute the base 10 logarithm of Logn = Log(n) / Log(10.0), where Logn is just a variable you'd define to store the result (you can name it whatever you want, of course).## See AlsoTake a peek at Recipe 7.13 for more information on Excel's support for taking logarithms of complex numbers. |

# Recipe7.4.Exploring Exponential and Logarithmic Functions

Similar products

Similar pages