The FORECAST.LINEAR function in Google Sheets is a powerful tool used for predicting future values based on existing data. This statistical function calculates a linear forecast by using the method of least squares, which is valuable in various fields, including finance, sales, and project management. By analyzing historical data points, this function provides an estimate for potential outcomes when additional data points are inputted.
Syntax
FORECAST.LINEAR(x, data_y, data_x)
- x: The data point for which you want to predict a corresponding value.
- data_y: The range of dependent data values (y-values) that correlate with the independent data.
- data_x: The range of independent data values (x-values) that are used in the prediction.
Example #1
FORECAST.LINEAR(5, B2:B10, A2:A10)
This function call predicts the value corresponding to x=5 based on the data in columns A and B. For instance, if B2:B10 has the sales figures and A2:A10 has the time periods, this function can give an estimate for sales at time 5. Result Example: $2000
Example #2
FORECAST.LINEAR(10, C2:C15, B2:B15)
This function predicts the y-value at x=10, using the data ranges C2:C15 and B2:B15. If C contains temperatures and B contains time intervals, you will receive a forecasted temperature at time 10. Result Example: 75°F
Example #3
FORECAST.LINEAR(15, D2:D20, E2:E20)
This example forecasts the value at x=15 using the ranges D2:D20 and E2:E20. For instance, if D holds expenses and E depicts months, the result will be a predicted expense for month 15. Result Example: $5000
Error handling
- N/A: This error occurs if the provided ranges do not match in size or if there are insufficient data points to make a forecast.
- VALUE!: Happens when the input for x, data_y, or data_x is of the wrong type (e.g., non-numeric).
- REF!: Indicates that a reference is invalid, often due to deleted rows or columns involved in the calculation.