August 2, 2019

TREND Function in Excel

How to use the trend function manually and with VBA to predict trends, for example, of sales. Watch the video below:

Watch this video on YouTube.

Here’s the complete VBA code:

Option Explicit

Sub viewTrend()

Range(“D2:D4”) = Application.WorksheetFunction.Trend(Range(“B2:B16”), Range(“A2:A16”), Range(“C2:C4”))

End Sub

The TREND function in Microsoft Excel returns values along a linear trend. Therefore, we draw a linear trend-line for our data because most data, for example for sales, will not be linear. We can extrapolate our linear trendline to estimate the sales, for example, in future. We can also use the trend function to perform the same calculations. We can use the known y values (sales amount) and the connecting x-values (months, quarters or years) and estimate the future sales value with a certain level of confidence. The trend function cannot take care of change in business environment or sudden change in government policies.

The trend function fits a straight line (using the method of least squares) to the array of sales (y-axis) and time data (x-axis) and returns the sales amounts (y values on the y-axis) for the new time values (x values on the x-axis).

How is the trend function different from the forecast function?

The forecast function is normally used to compute a single sales value (y value) based on a new time value (x value). The trend function can easily calculate the y-value (sales) for a series of x-values (time). You can watch a video on the forecast function on YouTube.