TREND function
The TREND function in Excel is used to calculate the linear trend of a set of data points. It fits a straight line (using linear regression) to the given data and predicts future values based on that trend. The function can be used to predict values of a dependent variable (y-values) given corresponding independent variable values (x-values).
This function is useful for forecasting, identifying trends, and performing linear regression analysis.
Syntax
=TREND(known_y's, [known_x's], [new_x's], [const])
Parameters
- known_y’s (required): The dependent variable values (y-values), which are the data points you want to predict based on the independent variable.
- known_x’s (optional): The independent variable values (x-values), which are the data points used to predict the corresponding y-values. If omitted, Excel assumes the x-values are the range of numbers {1, 2, 3, …}.
- new_x’s (optional): The new x-values for which you want to predict the corresponding y-values. These are the x-values where you want the trend to be projected. If omitted, the function uses the
known_x'svalues. - const (optional): A logical value (TRUE or FALSE) that determines whether to force the intercept of the regression line to be 0.
- TRUE (default): Excel calculates the intercept normally.
- FALSE: Excel forces the intercept to be 0, which assumes that the line goes through the origin (0,0).
Key Points
- Linear Regression: The
TRENDfunction uses linear regression to calculate the line of best fit, which is represented by the equation , where is the slope and is the y-intercept. - Forecasting: This function is often used for forecasting future values based on historical data.
- Extrapolation: It can be used to extrapolate data (predict beyond the known data points) if you provide new x-values.
Example Usage
1. Simple Trend Calculation
Suppose you have the following data showing the sales of a product for 5 months:
| Month (x) | Sales (y) |
|---|---|
| 1 | 200 |
| 2 | 220 |
| 3 | 240 |
| 4 | 260 |
| 5 | 280 |
You want to predict the sales for the 6th month based on the trend of the first 5 months.
- known_y’s: B2:B6 (Sales values)
- known_x’s: A2:A6 (Month values)
- new_x’s: A7 (Month 6, where you want the prediction)
To calculate the predicted sales for Month 6:
=TREND(B2:B6, A2:A6, A7)
Result: The formula will return 300, which is the predicted sales for the 6th month based on the linear trend.
2. Multiple Predictions
Suppose you want to predict sales for months 6 to 8 based on the same data.
- known_y’s: B2:B6 (Sales values)
- known_x’s: A2:A6 (Month values)
- new_x’s: A7:A9 (Months 6 to 8)
To calculate the predicted sales for Months 6 to 8:
=TREND(B2:B6, A2:A6, A7:A9)
Result: This will return an array of predicted sales values for months 6, 7, and 8 based on the trend, e.g., 300, 320, and 340, respectively.
3. Forcing the Intercept to 0
If you believe the trend should pass through the origin (i.e., the intercept should be 0), you can set the const argument to FALSE.
For example:
=TREND(B2:B6, A2:A6, A7:A9, FALSE)
This will force the trend line to pass through the origin (0,0), and Excel will calculate the slope without an intercept.
Notes
- Extrapolation: The
TRENDfunction can also be used to extrapolate data by providing future values innew_x's. However, extrapolating beyond the observed data should be done with caution, as trends may change over time. - Linear Trend: The
TRENDfunction assumes a linear relationship between the variables. If the data follows a non-linear pattern, other functions such asLOGEST(for exponential trends) or polynomial regression might be more suitable. - Array Formula: If you are predicting multiple values, you need to press Ctrl + Shift + Enter after typing the formula in earlier versions of Excel to make it an array formula. In newer versions of Excel, you can simply press Enter, and it will automatically handle arrays.
Related Functions
LINEST: Returns the statistics for a linear regression, including the slope and intercept, and is often used in combination withTREND.FORECAST: Predicts a future value based on existing data and a linear regression model. It is similar toTREND, but it is used for predicting a single value.GROWTH: Calculates an exponential growth trend for data, which is useful when your data follows an exponential pattern rather than a linear one.LOGEST: Performs exponential regression and returns an array of values that describe the exponential growth of the data.
The TREND function is a powerful tool for predicting future values based on existing data, especially when the data follows a linear trend. It’s useful for forecasting, regression analysis, and modeling trends over time.