Practice free

FORECAST function

FORECAST fits a straight line to past data by least squares and returns the predicted y for a new x. It is kept for compatibility, and FORECAST.LINEAR gives the same result.

Example

Read it as a sentence: use the pairs in F1:F5 and G1:G5 to draw a straight trend line, then predict the G value when F is 6, which gives 5.8.

Practice this in the app

Syntax

FORECAST(x, known_y's, known_x's)

x (required)
The x value to predict for.
known_y's (required)
Known dependent values.
known_x's (required)
Known independent values.

Returns: The predicted y for the given x on a straight-line fit.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=FORECAST(6,{2,4,5,4,5},{1,2,3,4,5}) 5.8 Array constants
=FORECAST(6,Data!G1:G5,Data!F1:F5) 5.8 Working example (ranges)
=FORECAST("6",Data!G1:G5,Data!F1:F5) 5.8 Text-number x
=FORECAST(6,Data!I1:I5,Data!H1:H5) 6.25 Blank pairs dropped
=FORECAST({6,7},Data!G1:G5,Data!F1:F5) 5.8 Array x (spills)
=FORECAST(6,Data!G1:G5,Data!J1:J5) #DIV/0! Constant x
=FORECAST(6,Data!G1:G5,Data!K1:K3) #N/A Different sizes
=FORECAST("abc",Data!G1:G5,Data!F1:F5) #VALUE! Text x

The Data sheet these formulas read

A cell that starts with = holds that formula.

Watch out for

  • Argument order is y values first, then x values.
  • Both ranges must be the same size.
  • Assumes a straight-line trend.

Where it works

Excel
FORECAST is in every version of Excel from 2007 on.
Google Sheets
Same name, same behaviour for everyday use.

Part of Statistical functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .