Article ID: 828236  View products that this article applies to. On This PageSUMMARYThis article describes the FORECAST function in Microsoft
Excel. This article discusses how the function is used. This article also compares the results
of FORECAST in Microsoft Office Excel 2003 and in later versions of Excel with the results of FORECAST in earlier versions of Excel.
MORE INFORMATIONThe FORECAST(x, known_y's,known_x's) function returns the
predicted value of the dependent variable (represented in the data by
known_y's) for the specific value, x, of the independent variable (represented
in the data by known_x's) by using a best fit (least squares) linear regression
to predict y values from x values. If you assume that data pairs are plotted in a scatter plot with x values that are measured on the horizontal axis and with y values that are measured on the vertical axis, FORECAST returns the height of the best fit regression line at the specific value x on the horizontal axis. FORECAST is the value of y that would be predicted based on both the value of x and the regression line (characterized by its slope and intercept that can be found by using Excel's SLOPE and INTERCEPT functions). Syntax
The most common usage of FORECAST includes a specific x value plus 2 ranges of cells that contain the data, such as FORECAST(125, A1:A100, B1:B100). Example of usageTo illustrate the FORECAST function, follow these steps:
Cells A2:A7 and B2:B7 contain both the yvalues and the xvalues that are used to call FORECAST in cell A10. The x value is in cell D7. If you have a version of Excel that is earlier than Excel 2003, FORECAST may exhibit roundoff errors in the earlier versions. This behavior of FORECAST has been improved for Excel 2003 and for later versions of Excel. FORECAST(x, known_y's,known_x's) is the result that is obtained when the following expression is evaluated: INTERCEPT(known_y's,known_x's) + SLOPE(known_y's,known_x's) * x. While the code for FORECAST has not been directly changed for
Excel 2003 and for later versions of Excel, the behavior of FORECAST is improved as a result of improved code
for SLOPE. The code for INTERCEPT has also not been directly changed, but it
is improved also, because it also calls SLOPE.In versions of Excel that are earlier than Excel 2003, FORECAST may exhibit roundoff errors. If you add a positive constant to each of the observations in B2:B7, and add that same constant to x at the same time, it should not affect the value of FORECAST. If you were to plot x,y pairs with x on the horizontal axis and with y on the vertical axis, the data would just shift to the right if you add a positive constant to each x value. If x is shifted to the right by the same amount, the value of FORECAST should be unaffected. The best fit regression line would still have the same slope. However, the shifted data would have a different intercept. With the default value of 0 in D3, SLOPE in A9 is 0.775280899. Cells A10:A11 show values of INTERCEPT and FORECAST. Cell A12 contains the following expression that is evaluated when you calculate FORECAST: INTERCEPT(known_y's,known_x's) + SLOPE(known_y's,known_x's) * x Values in cells A11 and A12 will always agree because the value
in A12 is exactly what FORECAST returns. SLOPE should not vary as you add
different positive constants to the known_x's.If you increase the value in D3, a larger constant is added to B2:B7, and that same constant is added to the first argument of FORECAST. If D3 <= 7, there are no roundoff errors that appear in the first six decimal places of SLOPE. As a result, INTERCEPT and FORECAST are wellbehaved. Now change the value in D3 to 7.25, 7.5, 7.75, and 8. You will notice that SLOPE in A9 changes. This causes variations in the values in cells A11:A12. These values should remain constant throughout the experiment. Cells D7:D13 show that the values that are returned by FORECAST and the values that should have been returned by FORECAST had SLOPE (and INTERCEPT) not changed. These pairs of values are shown for the cases where D3 = 7.5 and 8, respectively. Note that roundoff errors have become so severe that division by 0 occurs when D3 = 8. Earlier versions of Excel exhibit incorrect answers in these cases because the effects of roundoff errors are more profound with the computational formula that is used by these versions. Still, the cases used in this experiment could be viewed as extreme. If you have Excel 2003 or a later version of Excel, there are not any changes in the common values in A11 and A12 if you try the experiment. However, cells D7:D13 show roundoff errors that you would have obtained with earlier versions of Excel. Results in earlier versions of ExcelThe article for SLOPE describes the less numerically robust formula that is used in earlier versions of Excel. It requires only one pass through the data. It is the shortcomings of SLOPE in these earlier versions of Excel that cause FORECAST to also exhibit roundoff errors in extreme cases.Results in Excel 2003 and in later versions of ExcelSLOPE is calculated by an improved procedure in Excel 2003 and in later versions of Excel, and this improves the performance of FORECAST. This procedure requires two passes through the data. Again, the article on SLOPE describes the improvement.ConclusionsReplacing a onepass approach with a twopass approach guarantees better numeric performance of SLOPE in Excel 2003 and in later versions of Excel, and this translates into a better performance of FORECAST. The results for Excel 2003 and for later versions of Excel will never be less accurate than results in earlier versions of Excel.However, you are not likely to see a difference between the results in later versions of Excel and the results in earlier versions of Excel in most practical examples. This occurs because typical data is unlikely to exhibit the kind of unusual behavior that this experiment illustrates. Numeric instability is most likely to appear in earlier versions of Excel when the data contains a high number of significant digits combined with relatively little variation between data values. The procedure of finding the sum of squared deviations about a sample mean has been improved in Excel 2003 and in later versions of Excel. The improved procedure performs the following actions:
The following list is a list of the functions that have been improved in Excel 2003 and in later versions of Excel in this way:
PropertiesArticle ID: 828236  Last Review: September 19, 2011  Revision: 3.0

Contact us for more help 