FORECAST Function
Predicts a y-value from a linear regression at a given x.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| x | The x-value at which to predict the corresponding y-value. | Required |
| known_ys | The dependent (y) values of the known data used to fit the line. | Required |
| known_xs | The independent (x) values of the known data; must match the size of known_ys. | Required |
Basic Example
Predict the next value on a rising trend
=FORECAST(6,{2,3,5,7,11},{1,2,3,4,5})The fitted line is y = -1 + 2.2x, so at x=6 the prediction is -1 + 2.2*6 = 12.2.
Advanced Examples
Example 1: Forecast from worksheet ranges
Project next month's revenueUse a column of past revenues and a column of period numbers
=FORECAST(13,B2:B12,A2:A12)Example 2: Equivalence to FORECAST.LINEAR
Legacy vs modern nameBoth return the same prediction
=FORECAST(6,{2,3,5,7,11},{1,2,3,4,5}) and =FORECAST.LINEAR(6,{2,3,5,7,11},{1,2,3,4,5})How FORECAST Works
FORECAST fits a straight line y = a + bx by least squares, where the slope b = Σ((x - x̄)(y - ȳ)) / Σ(x - x̄)² and the intercept a = ȳ - b·x̄. It then evaluates that line at the supplied x. The prediction is purely linear and assumes the underlying relationship is roughly straight.
Important Notes & Limitations
Models only a linear relationship; curved trends need TREND/GROWTH or transforms.
known_xs and known_ys must have the same number of points, or #N/A is returned.
If the x-values have no variance (all equal), the function returns #DIV/0!.
Common Errors & Fixes
#N/Aknown_xs and known_ys have different sizes, or a non-numeric x was supplied.Fix: Make the two arrays the same length and pass a numeric x.
#DIV/0!All known_xs values are identical, so the slope is undefined.Fix: Provide x-values that actually vary.
Download Practice File
FORECAST
forecastPractice FORECAST with Real Data
Download a sample CSV file with pre-populated data and practice exercises for the FORECAST function. Works in both Excel and Google Sheets.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps