The Excel Forecast Function calculates a new yvalue using the simple straight line equation:
where,andand the values of x and y are the sample means (the averages) of the known x and yvalues.The Excel Forecast function predicts a future point on a linear trend line fitted to a supplied set of x and y values.
The syntax of the function is:
Where the arguments are as follows:
x    A numeric xvalue for which you want to forecast a new yvalue. 
known_y's    An array of known yvalues. 
known_x's    An array of known xvalues. Note that the length of the known_x's array should be the same length as known_y's, and the variance of the known_x's must not be zero. 
Note that, in Excel 2016 the Forecast function has been replaced by the Forecast.Linear function. However, the Forecast function is still available in Excel 2016, to ensure compatibility with earlier versions of Excel.
In the spreadsheet below, the Excel Forecast function is used to predict an additional point along the straight line of best fit through a set of known x and yvalues (stored in cells F2:F7 and G2:G7).
As shown in cell F7 of the spreadsheet, the function to calculate the forecast yvalue at x=7 is:
This gives the result 32.666667.
For further examples of the Excel Forecast function, see the Microsoft Office website
If you get an error from the Forecast function, this is likely to be one of the following:
#N/A    Occurs if either:

#DIV/0!    Occurs if the variance of the supplied known_x's is equal to zero. 
#VALUE!    Occurs if the supplied future value of x is nonnumeric. 