WorksheetFunction.Forecast_Linear 方法 (Excel)WorksheetFunction.Forecast_Linear method (Excel)

使用現有的值計算或預測未來的值。Calculates, or predicts, a future value by using existing values. 預測值是根據假設的 x 值求得 y 值。The predicted value is a y-value for a given x-value. 已知值包括現有的 x 值和 y 值,而新的值則利用線性回歸法求得。The known values are existing x-values and y-values, and the new value is predicted by using linear regression. 您可以用這個函數預測未來銷售額、庫存需求或消費趨勢。You can use this function to predict future sales, inventory requirements, or consumer trends.


運算式Forecast_Linear(Arg1Arg2Arg3)expression.Forecast_Linear (Arg1, Arg2, Arg3)

_運算式_代表**WorksheetFunction** 物件的變數。expression A variable that represents a WorksheetFunction object.


名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
Arg1Arg1 必要Required DoubleDouble x-要預測值的資料點。x - the data point for which you want to predict a value.
Arg2Arg2 必要Required VariantVariant known_y's-相依的陣列或資料範圍。known_y's - the dependent array or range of data.
Arg3Arg3 必要Required VariantVariant known_x's-獨立的陣列或資料範圍。known_x's - the independent array or range of data.

傳回值Return value



如果 x 為非數值, Forecast_Linear會傳回 #VALUE !If x is nonnumeric, Forecast_Linear returns the #VALUE! 錯誤值。error value.

如果_known_y's_和_known_x's_的參數為空白或包含不同數目的資料點, Forecast_Linear會傳回 # n/A 錯誤值。If known_y and known_x parameters are empty or contain a different number of data points, Forecast_Linear returns the #N/A error value.

如果_known_x's_參數的變異數等於零, Forecast_Linear會傳回 #DIV/0 !If the variance of known_x parameters equals zero, Forecast_Linear returns the #DIV/0! 錯誤值。error value.

Forecast_Linear的方程式為 a + bx,其中 公式 和 公式 其中 x 及 y 為樣本平均數 AVERAGE (所有_known_x's_) 和 AVERAGE (所有_known_y's_).The equation for Forecast_Linear is a+bx, where   Formula   and   Formula   and where x and y are the sample means AVERAGE(all known_x) and AVERAGE(all known_y).


Dim instance As WorksheetFunction
Dim Arg1 As Double
Dim Arg2 As Object
Dim Arg3 As Object
Dim returnValue As Double

returnValue = instance.Forecast_Linear(Arg1, Arg2, Arg3)

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.