# WorksheetFunction.Forecast_Linear 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. You can use this function to predict future sales, inventory requirements, or consumer trends.

## Syntax

*expression*.**Forecast_Linear** (*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_Linear** returns the #VALUE! error value.

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.

If the variance of *known_x* parameters equals zero, **Forecast_Linear** returns the #DIV/0! error value.

The equation for **Forecast_Linear** is a+bx, where and and where x and y are the sample means AVERAGE(all *known_x*) and AVERAGE(all *known_y*).

## Example

```
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

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.