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.

Published by

Dinesh Kumar Takyar

Welcome to! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: For a structured Excel VBA training course online you can visit:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.