The TREND function in Google Sheets is designed to analyze and predict future values based on existing linear data. Utilizing the least squares method, it helps users fit a linear trend line to data points, enabling effective forecasting and data analysis for various applications, from sales projections to scientific research.
Syntax
TREND(known_y's, [known_x's], [new_x's], [const])
- known_y’s: A range of dependent data points you want to analyze.
- known_x’s: (Optional) A range of independent data points associated with the known y’s.
- new_x’s: (Optional) A range of new x-values for which you want to predict y-values.
- const: (Optional) A boolean value. If TRUE or omitted, the y-intercept is calculated normally; if FALSE, it is set to zero.
Example #1
TREND(A2:A10, B2:B10)
In this example, the function estimates values for the range A2:A10 based on the corresponding x-values in B2:B10. The predicted results reflect a linear relationship based on the data provided.
Example #2
TREND(A2:A10, B2:B10, C2:C5)
This call predicts y-values for the new x-values provided in C2:C5 using the existing y’s in A2:A10 and x’s in B2:B10. This is useful for forecasting future outcomes based on established trends.
Example #3
TREND(A2:A10, B2:B10, C2:C5, FALSE)
Here, the function calculates new y-values for C2:C5 while enforcing a zero y-intercept. This allows for cases where relationships shift dramatically, providing flexibility in trend analysis.
Error handling
- N/A: Occurs when there are insufficient data points to generate a trend line.
- VALUE! Indicates that the data types used in the function are incorrect.
- REF: Arises when a referenced range is invalid or out of bounds.