Excel TREND Function
The TREND function returns the linear trend line through a given set of dependent y-values and, optionally, a set of independent x-values. The function then extends the linear trendline to predict dependent y-values for a further supplied set of new x-values.
The TREND function predicts values along a linear trend.
- If you are using the Excel versions that are prior to Microsoft 365, you should select the output range first, then enter the TREND formula in the top-left-cell of the output range, and then press Ctrl + Shift + Enter to apply the function. For the users of Microsoft 365 and newer versions of Excel, you can just enter the formula the top-left-cell, and then press Enter.
- The existing data in the supplied known_y's and known_x's need to be linear data that, for the given x-values, the y-values should fit the linear curve y = mx + b. Otherwise, the output or the predicted values may be inaccurate.
- TREND returns the #REF! error if known_x's and known_y's are of different lengths.
- TREND returns the #VALUE! error if:
- Any of the values in the supplied nown_y's, known_x's or new_x's are non-numeric;
- The supplied const is not recognized as a logical value.
- The TREND function finds the line that best fits your data by using the least squares method. The equation for the line is as follows.
- For one range of x-values:
- y = mx + b
- For multiple ranges of x-values:
- y = m1x1 + m2x2 + ... + b
- y - the dependent variable to calculate.
- x - the independent variable to use to calculate y.
- m - the slope that shows how steep the line is.
- b - the constant (the intercept that equals to the value of y when x = 0).
- For information about how Microsoft Excel fits a line to data, see LINEST function.
Supposing you have a sales table of the first nine months of the year, to predict the sales of the next three months, please enter the formula below in the top cell, and press Enter to get the results if you are using Microsoft 365 or newer versions of Excel. Otherwise, select the output range first, then enter the formula below in the top cell of the output range, and then press Ctrl + Shift + Enter.