Rediger

Del via


WorksheetFunction.Forecast method (Excel)

Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. Use this function to predict future sales, inventory requirements, or consumer trends.

Note

This member is deprecated in Office 2016 and later versions.

Syntax

expression.Forecast (Arg1, Arg2, Arg3)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 Required Double x - the data point for which you want to predict a value.
Arg2 Required Variant known_y's - the dependent array or range of data.
Arg3 Required Variant known_x's - the independent array or range of data.

Return value

Double

Remarks

If x is nonnumeric, Forecast returns the #VALUE! error value.

If known_y's and known_x's are empty or contain a different number of data points, Forecast returns the #N/A error value.

If the variance of known_x's equals zero, Forecast returns the #DIV/0! error value.

The equation for FORECAST is a+bx, where   Screenshot of a formula that defines a value for the forecast equation.   and   Screenshot of the formula that defines the b value for the forecast equation.   and where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known_y's).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.