How to use the TREND Function – Excel, VBA, Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 9, 2023
Download Example Workbook

Download the example workbook

This tutorial demonstrates how to use the TREND Function in Excel to calculate y-values based on a trendline.

Trend Main

What is the TREND Function?

The TREND function in Excel is like the FORECAST function, used to predict an x value given known x and y values, except that it applies the regression equation for an array of x values. The function uses linear regression to determine the result. It is recommended to visit the FORECAST function [insert link to FORECAST page] before viewing this page to learn about linear regression.

How to use TREND

The TREND function takes four arguments:

=TREND(known_y’s, known_x’s, new_x’s, const)

Where, known_y’s and known_x’s refer to the x and y data in your data table, new_x’s is an array of data points you wish to predict the y-value for and const is a binary argument for calculating the y-intercept normally, or forcing the value to 0 and adjusting the slope values so that .

Although the latter 3 arguments of TREND are optional, it is recommended to include all arguments to ensure the data prediction is correct.

Let’s look at an example:

=TREND(C3:C7,B3;B7,B10:B17,TRUE)

PIC 01

TREND acts as a dynamic array formula which spills the result for the entire array, as shown with the light blue border around cells C10 to C17 in this example. Simply type the formula in cell C10 and hit enter, no need to fill or drag the formula down.

To show the regression equation that TREND found to predict our array of results, I’ve plotted the data:

PIC 02

The equation matches!

Non-Linear Regression with TREND

TREND can also be used for polynomial curve fitting.

PIC 03

Adding additional x columns and raising them to the nth degree fits a polynomial curve to the same degree. All x columns must be included in the arguments for known_x’s and new_x’s.

Graphing it:

PIC 04

TREND TIPS

If your data is formatted as an Excel table (usually by Ctrl+T), TREND will result in errors. Spilled array formulas are not supported inside of Excel tables. Move your data out of the table and try again.

PIC 06

If your new x’s array is not full, you will get a #VALUE! Error. Change the range in the function argument so it is continuous.PIC 07

TREND function in Google Sheets

The TREND function works exactly the same in Google Sheets as in Excel.

Trend Google

TREND Examples in VBA

You can also use the TREND function in VBA. Type:

application.worksheetfunction.trend(known_ys,known_xs,new_xs,const)

 

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions